Ejemplo n.º 1
0
    def test_is_template_script(self):
        template = self.templates['Pay-To-Public-Key-Hash Output']
        scr = Script.from_human('OP_DUP OP_HASH160 0x0000000000000000000000000000000000000000 OP_EQUALVERIFY OP_CHECKSIG')
        self.assertTrue(script_gen.is_template_script(scr, template))

        scr = Script.from_human('OP_DUP OP_HASH160 0x0000000000000000000000000000000000000000 OP_EQUAL OP_CHECKSIG')
        self.assertFalse(script_gen.is_template_script(scr, template))

        scr = Script.from_human('OP_DUP OP_HASH160 0x00000000000000000000000000000000000000 OP_EQUALVERIFY OP_CHECKSIG')
        self.assertFalse(script_gen.is_template_script(scr, template))
Ejemplo n.º 2
0
    def test_is_template_script(self):
        template = self.templates['Pay-To-Public-Key-Hash Output']
        scr = Script.from_human('OP_DUP OP_HASH160 0x0000000000000000000000000000000000000000 OP_EQUALVERIFY OP_CHECKSIG')
        self.assertTrue(script_gen.is_template_script(scr, template))

        scr = Script.from_human('OP_DUP OP_HASH160 0x0000000000000000000000000000000000000000 OP_EQUAL OP_CHECKSIG')
        self.assertFalse(script_gen.is_template_script(scr, template))

        scr = Script.from_human('OP_DUP OP_HASH160 0x00000000000000000000000000000000000000 OP_EQUALVERIFY OP_CHECKSIG')
        self.assertFalse(script_gen.is_template_script(scr, template))

        scr = Script.from_human('0x03569988948d05ddf970d610bc52f0d47fb21ec307a35d3cbeba6d11accfcd3c6a OP_CHECKSIG')
        self.assertTrue(script_gen.is_template_script(scr, self.templates['Pay-To-Public-Key']))

        scr = Script.from_human('0x3045022100f89cffc794d3c43bbaec99f61d0bb2eb72ea1df4be407f375e98f7039caab83d02204b24170189348f82d9af3049aadc1160904e7ef0ba3bc96f3fd241053f0b6de101 0x028f917ac4353d2027ef1be2d02b4dd657ef2ecf67191760c957e79f198b3579c6')
        self.assertTrue(script_gen.is_template_script(scr, self.templates['Signature Script']))

        scr = Script.from_human('0x304402200a156e3e5617cc1d795dfe0c02a5c7dab3941820f194eabd6107f81f25e0519102204d8c585635e03c9137b239893701dc280e25b162011e6474d0c9297d2650b46901 0x51210208b5b58fd9bf58f1d71682887182e7abd428756264442eec230dd021c193f8d9210245af4f2b1ae21c9310a3211f8d5debb296175e20b3a14b173ff30428e03d502d52ae')
        self.assertTrue(script_gen.is_template_script(scr, self.templates['Pay-To-Script-Hash Signature Script']))

        scr = Script.from_human('OP_0 0x304402200a156e3e5617cc1d795dfe0c02a5c7dab3941820f194eabd6107f81f25e0519102204d8c585635e03c9137b239893701dc280e25b162011e6474d0c9297d2650b46901 0x51210208b5b58fd9bf58f1d71682887182e7abd428756264442eec230dd021c193f8d9210245af4f2b1ae21c9310a3211f8d5debb296175e20b3a14b173ff30428e03d502d52ae')
        self.assertTrue(script_gen.is_template_script(scr, self.templates['Pay-To-Script-Hash Multisig Signature Script']))