diff --git a/lib/ucoinpy/api/bma/__init__.py b/lib/ucoinpy/api/bma/__init__.py index fbd95eaa0c535c5778860f71d60c595cec28deca..57e861a78b00ceda64a6256fb8e3a84b30523ea4 100644 --- a/lib/ucoinpy/api/bma/__init__.py +++ b/lib/ucoinpy/api/bma/__init__.py @@ -123,7 +123,10 @@ class API(object): Arguments: - `path`: the request path """ + if 'self_' in kwargs.keys(): + kwargs['self'] = kwargs.pop('self_') + logging.debug("POST : {0}".format(kwargs)) response = requests.post(self.reverse_url(path), data=kwargs, headers=self.headers) if response.status_code != 200: diff --git a/lib/ucoinpy/api/bma/wot/__init__.py b/lib/ucoinpy/api/bma/wot/__init__.py index 3e1c694a7ef51a99703fcbee009cc669f46b00e6..0de3bfc8a7d6d432a1d61ab7dc1ede2591bf19a6 100644 --- a/lib/ucoinpy/api/bma/wot/__init__.py +++ b/lib/ucoinpy/api/bma/wot/__init__.py @@ -31,7 +31,7 @@ class Add(WOT): def __post__(self, **kwargs): assert 'pubkey' in kwargs - assert 'self' in kwargs + assert 'self_' in kwargs assert 'other' in kwargs return self.requests_post('/add', **kwargs).json() diff --git a/lib/ucoinpy/documents/certification.py b/lib/ucoinpy/documents/certification.py index 10a9cb5ec5cd24043e4369ea824ee02628a7a775..03898313e245b565e9ba1699bc690d8404889e77 100644 --- a/lib/ucoinpy/documents/certification.py +++ b/lib/ucoinpy/documents/certification.py @@ -79,7 +79,7 @@ class Certification(Document): def raw(self, selfcert): return """{0}META:TS:{1}-{2} -""".format(selfcert.signed_raw(), self.blockhash, self.blocknumber) +""".format(selfcert.signed_raw(), self.blocknumber, self.blockhash) def signed_raw(self, selfcert): raw = self.raw(selfcert) diff --git a/src/cutecoin/core/account.py b/src/cutecoin/core/account.py index f36419a741c30e55fc3ae5faefe16efe90307f45..45c675aceee234687c9b2f7db4a65d02da59e132 100644 --- a/src/cutecoin/core/account.py +++ b/src/cutecoin/core/account.py @@ -117,7 +117,7 @@ class Account(object): certification = Certification(PROTOCOL_VERSION, community.currency, self.pubkey, certified.pubkey, - block.number, block_hash, None) + block_hash, block.number, None) selfcert = certified.selfcert(community) raw_cert = certification.raw(selfcert) @@ -125,15 +125,17 @@ class Account(object): key = SigningKey(self.salt, password) signing = base64.b64encode(key.signature(bytes(raw_cert, 'ascii'))) - logging.debug("Signature : {0}".format(signing.decode("ascii"))) + logging.debug("Raw certification {0}".format(raw_cert)) + logging.debug("Signature of {0}".format(signing.decode("ascii"))) certification.signatures = [signing.decode("ascii")] signed_cert = certification.signed_raw(selfcert) logging.debug("Certification : {0}".format(signed_cert)) - community.post(bma.wot.Add, {}, - {'pubkey': certified.pubkey, - 'self': selfcert.signed_raw(), - 'others': certification.inline() + "\n"}) + data = {'pubkey': certified.pubkey, + 'self_': selfcert.signed_raw(), + 'other': "{0}\n".format(certification.inline())} + logging.debug("Posted data : {0}".format(data)) + community.post(bma.wot.Add, {}, data) def sources(self, community): sources = [] diff --git a/src/cutecoin/core/community.py b/src/cutecoin/core/community.py index c060f1adca84588bcbb83efe9e1a2e920f2f01e4..5138b40576df28cf5b0c6603f6ec6cab105bb268 100644 --- a/src/cutecoin/core/community.py +++ b/src/cutecoin/core/community.py @@ -145,7 +145,6 @@ class Community(object): e = next(e for e in peer.endpoints if type(e) is BMAEndpoint) logging.debug("Trying to connect to : " + peer.pubkey) req = request(e.conn_handler(), **req_args) - logging.debug("{0}".format(post_args)) req.post(**post_args) def jsonify_peers_list(self):