@@ -169,10 +169,10 @@ def get_utxo(self, *, txid: str = '', vout: Optional[int] = None, mark_as_spent=
169169 else :
170170 return self ._utxos [index ]
171171
172- def send_self_transfer (self , ** kwargs ):
172+ def send_self_transfer (self , * , from_node , * *kwargs ):
173173 """Create and send a tx with the specified fee_rate. Fee may be exact or at most one satoshi higher than needed."""
174174 tx = self .create_self_transfer (** kwargs )
175- self .sendrawtransaction (from_node = kwargs [ ' from_node' ] , tx_hex = tx ['hex' ])
175+ self .sendrawtransaction (from_node = from_node , tx_hex = tx ['hex' ])
176176 return tx
177177
178178 def send_to (self , * , from_node , scriptPubKey , amount , fee = 1000 ):
@@ -187,14 +187,14 @@ def send_to(self, *, from_node, scriptPubKey, amount, fee=1000):
187187
188188 Returns a tuple (txid, n) referring to the created external utxo outpoint.
189189 """
190- tx = self .create_self_transfer (from_node = from_node , fee_rate = 0 )["tx" ]
190+ tx = self .create_self_transfer (fee_rate = 0 )["tx" ]
191191 assert_greater_than_or_equal (tx .vout [0 ].nValue , amount + fee )
192192 tx .vout [0 ].nValue -= (amount + fee ) # change output -> MiniWallet
193193 tx .vout .append (CTxOut (amount , scriptPubKey )) # arbitrary output -> to be returned
194194 txid = self .sendrawtransaction (from_node = from_node , tx_hex = tx .serialize ().hex ())
195195 return txid , 1
196196
197- def send_self_transfer_multi (self , ** kwargs ):
197+ def send_self_transfer_multi (self , * , from_node , * *kwargs ):
198198 """
199199 Create and send a transaction that spends the given UTXOs and creates a
200200 certain number of outputs with equal amounts.
@@ -206,24 +206,26 @@ def send_self_transfer_multi(self, **kwargs):
206206 - list of newly created UTXOs, ordered by vout index
207207 """
208208 tx = self .create_self_transfer_multi (** kwargs )
209- txid = self .sendrawtransaction (from_node = kwargs [ ' from_node' ] , tx_hex = tx .serialize ().hex ())
209+ txid = self .sendrawtransaction (from_node = from_node , tx_hex = tx .serialize ().hex ())
210210 return {'new_utxos' : [self .get_utxo (txid = txid , vout = vout ) for vout in range (len (tx .vout ))],
211211 'txid' : txid , 'hex' : tx .serialize ().hex (), 'tx' : tx }
212212
213213 def create_self_transfer_multi (
214- self , * , from_node ,
215- utxos_to_spend : Optional [List [dict ]] = None ,
216- num_outputs = 1 ,
217- sequence = 0 ,
218- fee_per_output = 1000 ):
214+ self ,
215+ * ,
216+ utxos_to_spend : Optional [List [dict ]] = None ,
217+ num_outputs = 1 ,
218+ sequence = 0 ,
219+ fee_per_output = 1000 ,
220+ ):
219221 """
220222 Create and return a transaction that spends the given UTXOs and creates a
221223 certain number of outputs with equal amounts.
222224 """
223225 utxos_to_spend = utxos_to_spend or [self .get_utxo ()]
224226 # create simple tx template (1 input, 1 output)
225227 tx = self .create_self_transfer (
226- fee_rate = 0 , from_node = from_node ,
228+ fee_rate = 0 ,
227229 utxo_to_spend = utxos_to_spend [0 ], sequence = sequence )["tx" ]
228230
229231 # duplicate inputs, witnesses and outputs
@@ -241,9 +243,8 @@ def create_self_transfer_multi(
241243 o .nValue = outputs_value_total // num_outputs
242244 return tx
243245
244- def create_self_transfer (self , * , fee_rate = Decimal ("0.003" ), from_node = None , utxo_to_spend = None , locktime = 0 , sequence = 0 ):
246+ def create_self_transfer (self , * , fee_rate = Decimal ("0.003" ), utxo_to_spend = None , locktime = 0 , sequence = 0 ):
245247 """Create and return a tx with the specified fee_rate. Fee may be exact or at most one satoshi higher than needed."""
246- from_node = from_node or self ._test_node
247248 utxo_to_spend = utxo_to_spend or self .get_utxo ()
248249 if self ._mode in (MiniWalletMode .RAW_OP_TRUE , MiniWalletMode .ADDRESS_OP_TRUE ):
249250 vsize = Decimal (85 ) # anyone-can-spend
0 commit comments