improved test logic
@@ -12,7 +12,6 @@ import unittest
from hashlib import sha256
from btclib import dsa, ssa
-from btclib.curvemult import mult
from btclib.signtocontract import (ecdsa_commit_sign, ecssa_commit_sign,
verify_commit)
from btclib.curves import secp256k1 as ec
@@ -20,17 +19,17 @@ from btclib.curves import secp256k1 as ec
class TestSignToContract(unittest.TestCase):
def test_signtocontract(self):
- prv = 0x1
- pub = mult(prv)
m = b"to be signed"
c = b"to be committed"
+ prv, pub = dsa.gen_keys()
dsa_sig, dsa_receipt = ecdsa_commit_sign(c, m, prv, None)
self.assertIsNone(dsa._verify(m, pub, dsa_sig, ec, sha256))
self.assertTrue(verify_commit(c, dsa_receipt))
# 32 bytes message for ECSSA
m = sha256(m).digest()
+ prv, pub = ssa.gen_keys()
ssa_sig, ssa_receipt = ecssa_commit_sign(c, m, prv, None)
self.assertIsNone(ssa._verify(m, pub, ssa_sig, ec, sha256))
self.assertTrue(verify_commit(c, ssa_receipt))
