def testAddSigToUSTX(self): ustxi = UnsignedTxInput(tx1raw, 1, None, self.pubKey) a160_1 = addrStr_to_hash160('mhyjJTq9RsDfhNdjTkga1CKhTiL5VFw85J')[1] a160_2 = addrStr_to_hash160('mgoCqfR25kZVApAGFK3Tx5CTNcCppmKwfb')[1] dtxo1 = DecoratedTxOut(hash160_to_p2pkhash_script(a160_1), long(1.00 * ONE_BTC)) dtxo2 = DecoratedTxOut(hash160_to_p2pkhash_script(a160_2), long(0.49 * ONE_BTC)) ustx = UnsignedTransaction().createFromUnsignedTxIO([ustxi], [dtxo1, dtxo2]) msIndex = ustx.insertSignatureForInput(0, self.sigStr, self.pubKey) self.assertEqual(msIndex, 0) msIndex = ustx.insertSignatureForInput(0, self.sigStr) self.assertEqual(msIndex, 0) badSig = self.sigStr[:16] + '\x00' * 8 + self.sigStr[24:] msIndex = ustx.insertSignatureForInput(0, badSig) self.assertEqual(msIndex, -1)