File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ def __getattr__(self, name):
149149 def __setattr__ (self , name ):
150150 return setattr (self .instance , name )
151151
152- def generate_and_send_coins (node , address ):
152+ def generate_and_send_coins (node , address , data = None ):
153153 """Generate blocks on node and then send 1 BTC to address.
154154
155155 No change output is added to the transaction.
@@ -171,7 +171,10 @@ def generate_and_send_coins(node, address):
171171 # Create a raw transaction sending 1 BTC to the address, then sign and send it.
172172 # We won't create a change output, so maxfeerate must be set to 0
173173 # to allow any fee rate.
174- tx_hex = node .createrawtransaction (inputs = inputs , outputs = [{address : 1 }])
174+
175+ # An OP_RETURN output is added at index 1 if data is provided.
176+ outputs = [{address : 1 }, {"data" : data }] if data else [{address : 1 }]
177+ tx_hex = node .createrawtransaction (inputs = inputs , outputs = outputs )
175178
176179 res = node .signrawtransactionwithwallet (hexstring = tx_hex )
177180
You can’t perform that action at this time.
0 commit comments