fix redeem scripthash test

This commit is contained in:
Lex Berezhny 2022-04-08 10:11:11 -04:00
parent 8fb14bf713
commit 84ef52cf4d
2 changed files with 6 additions and 6 deletions

View file

@ -362,8 +362,8 @@ class InputScript(Script):
SMALL_INTEGER('signatures_count'), PUSH_MANY('pubkeys'), SMALL_INTEGER('pubkeys_count'),
OP_CHECKMULTISIG
))
REDEEM_SCRIPT_HASH_MULTI_SIG = Template('script_hash+mult_sig', (
PUSH_SINGLE('signature'), PUSH_SINGLE('pubkey'), PUSH_SUBSCRIPT('script', MULTI_SIG_SCRIPT)
REDEEM_SCRIPT_HASH_MULTI_SIG = Template('script_hash+multi_sig', (
OP_0, PUSH_MANY('signatures'), PUSH_SUBSCRIPT('script', MULTI_SIG_SCRIPT)
))
TIME_LOCK_SCRIPT = Template('timelock', (
PUSH_INTEGER('height'), OP_CHECKLOCKTIMEVERIFY, OP_DROP,
@ -389,7 +389,7 @@ class InputScript(Script):
})
@classmethod
def redeem_mult_sig_script_hash(cls, signatures, pubkeys):
def redeem_multi_sig_script_hash(cls, signatures, pubkeys):
return cls(template=cls.REDEEM_SCRIPT_HASH_MULTI_SIG, values={
'signatures': signatures,
'script': cls(template=cls.MULTI_SIG_SCRIPT, values={

View file

@ -130,12 +130,12 @@ class TestRedeemScriptHash(unittest.TestCase):
def redeem_script_hash(self, sigs, pubkeys):
# this checks that factory function correctly sets up the script
src1 = InputScript.redeem_script_hash(
src1 = InputScript.redeem_multi_sig_script_hash(
[unhexlify(sig) for sig in sigs],
[unhexlify(pubkey) for pubkey in pubkeys]
)
subscript1 = src1.values['script']
self.assertEqual(src1.template.name, 'script_hash')
self.assertEqual(src1.template.name, 'script_hash+multi_sig')
self.assertListEqual([hexlify(v) for v in src1.values['signatures']], sigs)
self.assertListEqual([hexlify(p) for p in subscript1.values['pubkeys']], pubkeys)
self.assertEqual(subscript1.values['signatures_count'], len(sigs))
@ -143,7 +143,7 @@ class TestRedeemScriptHash(unittest.TestCase):
# now we test that it will round trip
src2 = InputScript(src1.source)
subscript2 = src2.values['script']
self.assertEqual(src2.template.name, 'script_hash')
self.assertEqual(src2.template.name, 'script_hash+multi_sig')
self.assertListEqual([hexlify(v) for v in src2.values['signatures']], sigs)
self.assertListEqual([hexlify(p) for p in subscript2.values['pubkeys']], pubkeys)
self.assertEqual(subscript2.values['signatures_count'], len(sigs))