commit 901dda089802797639166ce937e020b6a18c382b
parent 988fb4e4135ef8536cdcfa1066868ed0489bf9f0
Author: ThomasV <thomasv@electrum.org>
Date: Wed, 4 Oct 2017 14:49:01 +0200
Merge pull request #2981 from SomberNight/fix_tests_msg_signing
fix tests: message signing
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/tests/test_bitcoin.py b/lib/tests/test_bitcoin.py
@@ -14,7 +14,7 @@ from lib.bitcoin import (
bip32_root, bip32_public_derivation, bip32_private_derivation, pw_encode,
pw_decode, Hash, public_key_from_private_key, address_from_private_key,
is_address, is_private_key, xpub_from_xprv, is_new_seed, is_old_seed,
- var_int, op_push, address_to_script, sign_message_with_wif_privkey,
+ var_int, op_push, address_to_script, regenerate_key,
verify_message, deserialize_privkey)
from lib.util import bfh
@@ -61,6 +61,11 @@ class Test_bitcoin(unittest.TestCase):
msg1 = b'Chancellor on brink of second bailout for banks'
msg2 = b'Electrum'
+ def sign_message_with_wif_privkey(wif_privkey, msg):
+ txin_type, privkey, compressed = deserialize_privkey(wif_privkey)
+ key = regenerate_key(privkey)
+ return key.sign_message(msg, compressed)
+
sig1 = sign_message_with_wif_privkey(
'L1TnU2zbNaAqMoVh65Cyvmcjzbrj41Gs9iTLcWbpJCMynXuap6UN', msg1)
sig2 = sign_message_with_wif_privkey(