@@ -180,10 +180,10 @@ def get_utxos(self, *, mark_as_spent=True):
180180 self ._utxos = []
181181 return utxos
182182
183- def send_self_transfer (self , ** kwargs ):
183+ def send_self_transfer (self , * , from_node , * *kwargs ):
184184 """Create and send a tx with the specified fee_rate. Fee may be exact or at most one satoshi higher than needed."""
185185 tx = self .create_self_transfer (** kwargs )
186- self .sendrawtransaction (from_node = kwargs [ ' from_node' ] , tx_hex = tx ['hex' ])
186+ self .sendrawtransaction (from_node = from_node , tx_hex = tx ['hex' ])
187187 return tx
188188
189189 def send_to (self , * , from_node , scriptPubKey , amount , fee = 1000 ):
@@ -198,14 +198,14 @@ def send_to(self, *, from_node, scriptPubKey, amount, fee=1000):
198198
199199 Returns a tuple (txid, n) referring to the created external utxo outpoint.
200200 """
201- tx = self .create_self_transfer (from_node = from_node , fee_rate = 0 )["tx" ]
201+ tx = self .create_self_transfer (fee_rate = 0 )["tx" ]
202202 assert_greater_than_or_equal (tx .vout [0 ].nValue , amount + fee )
203203 tx .vout [0 ].nValue -= (amount + fee ) # change output -> MiniWallet
204204 tx .vout .append (CTxOut (amount , scriptPubKey )) # arbitrary output -> to be returned
205205 txid = self .sendrawtransaction (from_node = from_node , tx_hex = tx .serialize ().hex ())
206206 return txid , 1
207207
208- def send_self_transfer_multi (self , ** kwargs ):
208+ def send_self_transfer_multi (self , * , from_node , * *kwargs ):
209209 """
210210 Create and send a transaction that spends the given UTXOs and creates a
211211 certain number of outputs with equal amounts.
@@ -217,24 +217,26 @@ def send_self_transfer_multi(self, **kwargs):
217217 - list of newly created UTXOs, ordered by vout index
218218 """
219219 tx = self .create_self_transfer_multi (** kwargs )
220- txid = self .sendrawtransaction (from_node = kwargs [ ' from_node' ] , tx_hex = tx .serialize ().hex ())
220+ txid = self .sendrawtransaction (from_node = from_node , tx_hex = tx .serialize ().hex ())
221221 return {'new_utxos' : [self .get_utxo (txid = txid , vout = vout ) for vout in range (len (tx .vout ))],
222222 'txid' : txid , 'hex' : tx .serialize ().hex (), 'tx' : tx }
223223
224224 def create_self_transfer_multi (
225- self , * , from_node ,
226- utxos_to_spend : Optional [List [dict ]] = None ,
227- num_outputs = 1 ,
228- sequence = 0 ,
229- fee_per_output = 1000 ):
225+ self ,
226+ * ,
227+ utxos_to_spend : Optional [List [dict ]] = None ,
228+ num_outputs = 1 ,
229+ sequence = 0 ,
230+ fee_per_output = 1000 ,
231+ ):
230232 """
231233 Create and return a transaction that spends the given UTXOs and creates a
232234 certain number of outputs with equal amounts.
233235 """
234236 utxos_to_spend = utxos_to_spend or [self .get_utxo ()]
235237 # create simple tx template (1 input, 1 output)
236238 tx = self .create_self_transfer (
237- fee_rate = 0 , from_node = from_node ,
239+ fee_rate = 0 ,
238240 utxo_to_spend = utxos_to_spend [0 ], sequence = sequence )["tx" ]
239241
240242 # duplicate inputs, witnesses and outputs
@@ -253,9 +255,8 @@ def create_self_transfer_multi(
253255 o .nValue = outputs_value_total // num_outputs
254256 return tx
255257
256- def create_self_transfer (self , * , fee_rate = Decimal ("0.003" ), from_node = None , utxo_to_spend = None , locktime = 0 , sequence = 0 ):
258+ def create_self_transfer (self , * , fee_rate = Decimal ("0.003" ), utxo_to_spend = None , locktime = 0 , sequence = 0 ):
257259 """Create and return a tx with the specified fee_rate. Fee may be exact or at most one satoshi higher than needed."""
258- from_node = from_node or self ._test_node
259260 utxo_to_spend = utxo_to_spend or self .get_utxo ()
260261 if self ._mode in (MiniWalletMode .RAW_OP_TRUE , MiniWalletMode .ADDRESS_OP_TRUE ):
261262 vsize = Decimal (104 ) # anyone-can-spend
0 commit comments