@@ -1326,8 +1326,10 @@ def add_transactions_to_block(self, block, tx_list):
1326
1326
block .vtx .extend (tx_list )
1327
1327
1328
1328
# this is a little handier to use than the version in blocktools.py
1329
- def create_tx (self , spend_tx , n , value , script = CScript ([OP_TRUE , OP_DROP ] * 15 + [OP_TRUE ])):
1330
- return create_tx_with_script (spend_tx , n , amount = value , script_pub_key = script )
1329
+ def create_tx (self , spend_tx , n , value , output_script = None ):
1330
+ if output_script is None :
1331
+ output_script = CScript ([OP_TRUE , OP_DROP ] * 15 + [OP_TRUE ])
1332
+ return create_tx_with_script (spend_tx , n , amount = value , output_script = output_script )
1331
1333
1332
1334
# sign a transaction, using the key we know about
1333
1335
# this signs input 0 in tx, which is assumed to be spending output 0 in spend_tx
@@ -1338,13 +1340,17 @@ def sign_tx(self, tx, spend_tx):
1338
1340
return
1339
1341
sign_input_legacy (tx , 0 , spend_tx .vout [0 ].scriptPubKey , self .coinbase_key )
1340
1342
1341
- def create_and_sign_transaction (self , spend_tx , value , script = CScript ([OP_TRUE ])):
1342
- tx = self .create_tx (spend_tx , 0 , value , script )
1343
+ def create_and_sign_transaction (self , spend_tx , value , output_script = None ):
1344
+ if output_script is None :
1345
+ output_script = CScript ([OP_TRUE ])
1346
+ tx = self .create_tx (spend_tx , 0 , value , output_script = output_script )
1343
1347
self .sign_tx (tx , spend_tx )
1344
1348
tx .rehash ()
1345
1349
return tx
1346
1350
1347
- def next_block (self , number , spend = None , additional_coinbase_value = 0 , script = CScript ([OP_TRUE ]), * , version = 4 ):
1351
+ def next_block (self , number , spend = None , additional_coinbase_value = 0 , * , script = None , version = 4 ):
1352
+ if script is None :
1353
+ script = CScript ([OP_TRUE ])
1348
1354
if self .tip is None :
1349
1355
base_block_hash = self .genesis_hash
1350
1356
block_time = int (time .time ()) + 1
@@ -1361,7 +1367,7 @@ def next_block(self, number, spend=None, additional_coinbase_value=0, script=CSc
1361
1367
else :
1362
1368
coinbase .vout [0 ].nValue += spend .vout [0 ].nValue - 1 # all but one satoshi to fees
1363
1369
coinbase .rehash ()
1364
- tx = self .create_tx (spend , 0 , 1 , script ) # spend 1 satoshi
1370
+ tx = self .create_tx (spend , 0 , 1 , output_script = script ) # spend 1 satoshi
1365
1371
self .sign_tx (tx , spend )
1366
1372
tx .rehash ()
1367
1373
block = create_block (base_block_hash , coinbase , block_time , version = version , txlist = [tx ])
0 commit comments