@@ -63,19 +63,15 @@ def small_txpuzzle_randfee(
63
63
while total_in <= (amount + fee ) and len (conflist ) > 0 :
64
64
t = conflist .pop (0 )
65
65
total_in += t ["amount" ]
66
- tx .vin .append (CTxIn (COutPoint (int (t ["txid" ], 16 ), t ["vout" ]), b"" ))
66
+ tx .vin .append (CTxIn (COutPoint (int (t ["txid" ], 16 ), t ["vout" ]), REDEEM_SCRIPT ))
67
67
while total_in <= (amount + fee ) and len (unconflist ) > 0 :
68
68
t = unconflist .pop (0 )
69
69
total_in += t ["amount" ]
70
- tx .vin .append (CTxIn (COutPoint (int (t ["txid" ], 16 ), t ["vout" ]), b"" ))
70
+ tx .vin .append (CTxIn (COutPoint (int (t ["txid" ], 16 ), t ["vout" ]), REDEEM_SCRIPT ))
71
71
if total_in <= amount + fee :
72
72
raise RuntimeError (f"Insufficient funds: need { amount + fee } , have { total_in } " )
73
73
tx .vout .append (CTxOut (int ((total_in - amount - fee ) * COIN ), P2SH ))
74
74
tx .vout .append (CTxOut (int (amount * COIN ), P2SH ))
75
- # These transactions don't need to be signed, but we still have to insert
76
- # the ScriptSig that will satisfy the ScriptPubKey.
77
- for inp in tx .vin :
78
- inp .scriptSig = REDEEM_SCRIPT
79
75
txid = from_node .sendrawtransaction (hexstring = tx .serialize ().hex (), maxfeerate = 0 )
80
76
unconflist .append ({"txid" : txid , "vout" : 0 , "amount" : total_in - amount - fee })
81
77
unconflist .append ({"txid" : txid , "vout" : 1 , "amount" : amount })
@@ -218,7 +214,7 @@ def initial_split(self, node):
218
214
change = Decimal ("100" ) - splitted_amount * utxo_count - fee
219
215
tx = CTransaction ()
220
216
tx .vin = [
221
- CTxIn (COutPoint (int (cb ["txid" ], 16 ), cb ["vout" ]), b"" )
217
+ CTxIn (COutPoint (int (cb ["txid" ], 16 ), cb ["vout" ]))
222
218
for cb in node .listunspent ()[:2 ]
223
219
]
224
220
tx .vout = [CTxOut (int (splitted_amount * COIN ), P2SH ) for _ in range (utxo_count )]
0 commit comments