forked from LBRYCommunity/lbry-sdk
fix redeem scripthash test
This commit is contained in:
parent
8fb14bf713
commit
84ef52cf4d
2 changed files with 6 additions and 6 deletions
|
@ -362,8 +362,8 @@ class InputScript(Script):
|
||||||
SMALL_INTEGER('signatures_count'), PUSH_MANY('pubkeys'), SMALL_INTEGER('pubkeys_count'),
|
SMALL_INTEGER('signatures_count'), PUSH_MANY('pubkeys'), SMALL_INTEGER('pubkeys_count'),
|
||||||
OP_CHECKMULTISIG
|
OP_CHECKMULTISIG
|
||||||
))
|
))
|
||||||
REDEEM_SCRIPT_HASH_MULTI_SIG = Template('script_hash+mult_sig', (
|
REDEEM_SCRIPT_HASH_MULTI_SIG = Template('script_hash+multi_sig', (
|
||||||
PUSH_SINGLE('signature'), PUSH_SINGLE('pubkey'), PUSH_SUBSCRIPT('script', MULTI_SIG_SCRIPT)
|
OP_0, PUSH_MANY('signatures'), PUSH_SUBSCRIPT('script', MULTI_SIG_SCRIPT)
|
||||||
))
|
))
|
||||||
TIME_LOCK_SCRIPT = Template('timelock', (
|
TIME_LOCK_SCRIPT = Template('timelock', (
|
||||||
PUSH_INTEGER('height'), OP_CHECKLOCKTIMEVERIFY, OP_DROP,
|
PUSH_INTEGER('height'), OP_CHECKLOCKTIMEVERIFY, OP_DROP,
|
||||||
|
@ -389,7 +389,7 @@ class InputScript(Script):
|
||||||
})
|
})
|
||||||
|
|
||||||
@classmethod
|
@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={
|
return cls(template=cls.REDEEM_SCRIPT_HASH_MULTI_SIG, values={
|
||||||
'signatures': signatures,
|
'signatures': signatures,
|
||||||
'script': cls(template=cls.MULTI_SIG_SCRIPT, values={
|
'script': cls(template=cls.MULTI_SIG_SCRIPT, values={
|
||||||
|
|
|
@ -130,12 +130,12 @@ class TestRedeemScriptHash(unittest.TestCase):
|
||||||
|
|
||||||
def redeem_script_hash(self, sigs, pubkeys):
|
def redeem_script_hash(self, sigs, pubkeys):
|
||||||
# this checks that factory function correctly sets up the script
|
# 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(sig) for sig in sigs],
|
||||||
[unhexlify(pubkey) for pubkey in pubkeys]
|
[unhexlify(pubkey) for pubkey in pubkeys]
|
||||||
)
|
)
|
||||||
subscript1 = src1.values['script']
|
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(v) for v in src1.values['signatures']], sigs)
|
||||||
self.assertListEqual([hexlify(p) for p in subscript1.values['pubkeys']], pubkeys)
|
self.assertListEqual([hexlify(p) for p in subscript1.values['pubkeys']], pubkeys)
|
||||||
self.assertEqual(subscript1.values['signatures_count'], len(sigs))
|
self.assertEqual(subscript1.values['signatures_count'], len(sigs))
|
||||||
|
@ -143,7 +143,7 @@ class TestRedeemScriptHash(unittest.TestCase):
|
||||||
# now we test that it will round trip
|
# now we test that it will round trip
|
||||||
src2 = InputScript(src1.source)
|
src2 = InputScript(src1.source)
|
||||||
subscript2 = src2.values['script']
|
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(v) for v in src2.values['signatures']], sigs)
|
||||||
self.assertListEqual([hexlify(p) for p in subscript2.values['pubkeys']], pubkeys)
|
self.assertListEqual([hexlify(p) for p in subscript2.values['pubkeys']], pubkeys)
|
||||||
self.assertEqual(subscript2.values['signatures_count'], len(sigs))
|
self.assertEqual(subscript2.values['signatures_count'], len(sigs))
|
||||||
|
|
Loading…
Reference in a new issue