Skip to content

Commit

Permalink
Using signer secret key instead of crypto secret key
Browse files Browse the repository at this point in the history
  • Loading branch information
xoriole committed Mar 7, 2018
1 parent b30809a commit 9818aeb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ipv8/attestation/trustchain/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ def sign(self, key):
# Attach custom double signature to the transaction itself
sign_secret = doublesign.sha256("%s%s" % (key, self.block_id))
if self.transaction and isinstance(self.transaction, dict):
self.transaction['double_sig'] = crypto.create_custom_signature(key.key.hex_sk(), data, sign_secret)
signing_secret_key_hex = key.key.signer.sk[:32].encode('hex')
self.transaction['double_sig'] = crypto.create_custom_signature(signing_secret_key_hex, data, sign_secret)

@classmethod
def create(cls, transaction, database, public_key, link=None, link_pk=None):
Expand Down
3 changes: 2 additions & 1 deletion test/attestation/trustchain/test_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,6 @@ def test_double_spending(self):

# Check equality of the private keys
recovered_private_key = validation[2][1]
self.assertEqual(key.key.sk, recovered_private_key, "Recovered private key did not match.")
original_signing_secret_key = key.key.signer.sk[:32]
self.assertEqual(original_signing_secret_key, recovered_private_key, "Recovered private key did not match.")

0 comments on commit 9818aeb

Please sign in to comment.