@@ -63,19 +63,15 @@ def small_txpuzzle_randfee(
6363 while total_in <= (amount + fee ) and len (conflist ) > 0 :
6464 t = conflist .pop (0 )
6565 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 ))
6767 while total_in <= (amount + fee ) and len (unconflist ) > 0 :
6868 t = unconflist .pop (0 )
6969 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 ))
7171 if total_in <= amount + fee :
7272 raise RuntimeError (f"Insufficient funds: need { amount + fee } , have { total_in } " )
7373 tx .vout .append (CTxOut (int ((total_in - amount - fee ) * COIN ), P2SH ))
7474 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
7975 txid = from_node .sendrawtransaction (hexstring = tx .serialize ().hex (), maxfeerate = 0 )
8076 unconflist .append ({"txid" : txid , "vout" : 0 , "amount" : total_in - amount - fee })
8177 unconflist .append ({"txid" : txid , "vout" : 1 , "amount" : amount })
@@ -218,7 +214,7 @@ def initial_split(self, node):
218214 change = Decimal ("100" ) - splitted_amount * utxo_count - fee
219215 tx = CTransaction ()
220216 tx .vin = [
221- CTxIn (COutPoint (int (cb ["txid" ], 16 ), cb ["vout" ]), b"" )
217+ CTxIn (COutPoint (int (cb ["txid" ], 16 ), cb ["vout" ]))
222218 for cb in node .listunspent ()[:2 ]
223219 ]
224220 tx .vout = [CTxOut (int (splitted_amount * COIN ), P2SH ) for _ in range (utxo_count )]
0 commit comments