diff --git a/test/functional/abc_p2p_avalanche_transaction_voting.py b/test/functional/abc_p2p_avalanche_transaction_voting.py --- a/test/functional/abc_p2p_avalanche_transaction_voting.py +++ b/test/functional/abc_p2p_avalanche_transaction_voting.py @@ -239,9 +239,7 @@ int(node.getbestblockhash(), 16), create_coinbase(node.getblockcount() - 1), ) - conflicting_tx = wallet.create_self_transfer( - from_node=node, utxo_to_spend=utxo - )["tx"] + conflicting_tx = wallet.create_self_transfer(utxo_to_spend=utxo)["tx"] assert conflicting_tx.get_id() != txid conflicting_block.vtx.append(conflicting_tx) diff --git a/test/functional/feature_cltv.py b/test/functional/feature_cltv.py --- a/test/functional/feature_cltv.py +++ b/test/functional/feature_cltv.py @@ -31,7 +31,7 @@ CLTV_HEIGHT = 1351 -def cltv_lock_to_height(wallet, from_node, fundtx, height=-1): +def cltv_lock_to_height(fundtx, height=-1): """Modify the scriptPubKey to add an OP_CHECKLOCKTIMEVERIFY, and make a transaction that spends it. @@ -91,8 +91,8 @@ " block" ) - fundtx = wallet.create_self_transfer(from_node=self.nodes[0])["tx"] - fundtx, spendtx = cltv_lock_to_height(wallet, self.nodes[0], fundtx) + fundtx = wallet.create_self_transfer()["tx"] + fundtx, spendtx = cltv_lock_to_height(fundtx) tip = self.nodes[0].getbestblockhash() block_time = self.nodes[0].getblockheader(tip)["mediantime"] + 1 @@ -128,8 +128,8 @@ ) block.nVersion = 4 - fundtx = wallet.create_self_transfer(from_node=self.nodes[0])["tx"] - fundtx, spendtx = cltv_lock_to_height(wallet, self.nodes[0], fundtx) + fundtx = wallet.create_self_transfer()["tx"] + fundtx, spendtx = cltv_lock_to_height(fundtx) # The funding tx only has unexecuted bad CLTV, in scriptpubkey; this is # valid. @@ -182,10 +182,8 @@ " accepted" ) - fundtx = wallet.create_self_transfer(from_node=self.nodes[0])["tx"] - fundtx, spendtx = cltv_lock_to_height( - wallet, self.nodes[0], fundtx, height=CLTV_HEIGHT - ) + fundtx = wallet.create_self_transfer()["tx"] + fundtx, spendtx = cltv_lock_to_height(fundtx, height=CLTV_HEIGHT) # make sure sequence is nonfinal and locktime is good spendtx.vin[0].nSequence = 0xFFFFFFFE diff --git a/test/functional/feature_coinstatsindex.py b/test/functional/feature_coinstatsindex.py --- a/test/functional/feature_coinstatsindex.py +++ b/test/functional/feature_coinstatsindex.py @@ -163,9 +163,7 @@ # Generate and send another tx with an OP_RETURN output (which is # unspendable) - tx2 = self.wallet.create_self_transfer( - from_node=self.nodes[0], utxo_to_spend=tx1_out_21 - )["tx"] + tx2 = self.wallet.create_self_transfer(utxo_to_spend=tx1_out_21)["tx"] tx2.vout = [ CTxOut(int(20_990_000 * XEC), CScript([OP_RETURN] + [OP_FALSE] * 50)) ] diff --git a/test/functional/interface_usdt_utxocache.py b/test/functional/interface_usdt_utxocache.py --- a/test/functional/interface_usdt_utxocache.py +++ b/test/functional/interface_usdt_utxocache.py @@ -198,7 +198,7 @@ # Create a transaction and invalidate it by changing the txid of the previous # output to the coinbase txid of the block at height 1. - invalid_tx = self.wallet.create_self_transfer(from_node=self.nodes[0])["tx"] + invalid_tx = self.wallet.create_self_transfer()["tx"] invalid_tx.vin[0].prevout.txid = int(block_1_coinbase_txid, 16) self.log.info("hooking into the utxocache:uncache tracepoint") diff --git a/test/functional/mempool_reorg.py b/test/functional/mempool_reorg.py --- a/test/functional/mempool_reorg.py +++ b/test/functional/mempool_reorg.py @@ -49,15 +49,9 @@ "Create three transactions spending from coinbase utxos: spend_1, spend_2," " spend_3" ) - spend_1 = wallet.create_self_transfer( - from_node=self.nodes[0], utxo_to_spend=utxo_1 - ) - spend_2 = wallet.create_self_transfer( - from_node=self.nodes[0], utxo_to_spend=utxo_2 - ) - spend_3 = wallet.create_self_transfer( - from_node=self.nodes[0], utxo_to_spend=utxo_3 - ) + spend_1 = wallet.create_self_transfer(utxo_to_spend=utxo_1) + spend_2 = wallet.create_self_transfer(utxo_to_spend=utxo_2) + spend_3 = wallet.create_self_transfer(utxo_to_spend=utxo_3) self.log.info( "Create another transaction which is time-locked to two blocks in the" @@ -65,7 +59,6 @@ ) utxo = wallet.get_utxo(txid=coinbase_txids[0]) timelock_tx = wallet.create_self_transfer( - from_node=self.nodes[0], utxo_to_spend=utxo, locktime=self.nodes[0].getblockcount() + 2, )["hex"] @@ -88,12 +81,8 @@ ) self.log.info("Create spend_2_1 and spend_3_1") - spend_2_1 = wallet.create_self_transfer( - from_node=self.nodes[0], utxo_to_spend=spend_2["new_utxo"] - ) - spend_3_1 = wallet.create_self_transfer( - from_node=self.nodes[0], utxo_to_spend=spend_3["new_utxo"] - ) + spend_2_1 = wallet.create_self_transfer(utxo_to_spend=spend_2["new_utxo"]) + spend_3_1 = wallet.create_self_transfer(utxo_to_spend=spend_3["new_utxo"]) self.log.info("Broadcast and mine spend_3_1") spend_3_1_id = self.nodes[0].sendrawtransaction(spend_3_1["hex"]) diff --git a/test/functional/mempool_spend_coinbase.py b/test/functional/mempool_spend_coinbase.py --- a/test/functional/mempool_spend_coinbase.py +++ b/test/functional/mempool_spend_coinbase.py @@ -44,9 +44,7 @@ )["txid"] # other coinbase should be too immature to spend - immature_tx = wallet.create_self_transfer( - from_node=self.nodes[0], utxo_to_spend=utxo_immature - ) + immature_tx = wallet.create_self_transfer(utxo_to_spend=utxo_immature) assert_raises_rpc_error( -26, "bad-txns-premature-spend-of-coinbase", diff --git a/test/functional/p2p_blocksonly.py b/test/functional/p2p_blocksonly.py --- a/test/functional/p2p_blocksonly.py +++ b/test/functional/p2p_blocksonly.py @@ -133,7 +133,7 @@ def check_p2p_tx_violation(self): self.log.info("Check that txs from P2P are rejected and result in disconnect") - spendtx = self.miniwallet.create_self_transfer(from_node=self.nodes[0]) + spendtx = self.miniwallet.create_self_transfer() with self.nodes[0].assert_debug_log( ["transaction sent in violation of protocol peer=0"] diff --git a/test/functional/test_framework/wallet.py b/test/functional/test_framework/wallet.py --- a/test/functional/test_framework/wallet.py +++ b/test/functional/test_framework/wallet.py @@ -128,10 +128,10 @@ return self._utxos.pop(index) - def send_self_transfer(self, **kwargs): + def send_self_transfer(self, *, from_node, **kwargs): """Create and send a tx with the specified fee_rate. Fee may be exact or at most one satoshi higher than needed.""" tx = self.create_self_transfer(**kwargs) - self.sendrawtransaction(from_node=kwargs["from_node"], tx_hex=tx["hex"]) + self.sendrawtransaction(from_node=from_node, tx_hex=tx["hex"]) return tx def send_to(self, *, from_node, scriptPubKey, amount, fee=1000): @@ -144,7 +144,7 @@ (the utxo with the largest value is taken). Returns a tuple (txid, n) referring to the created external utxo outpoint. """ - tx = self.create_self_transfer(from_node=from_node, fee_rate=0)["tx"] + tx = self.create_self_transfer(fee_rate=0)["tx"] assert_greater_than_or_equal(tx.vout[0].nValue, amount + fee) # change output -> MiniWallet tx.vout[0].nValue -= amount + fee @@ -154,7 +154,7 @@ return txid, len(tx.vout) - 1 def create_self_transfer( - self, *, fee_rate=Decimal("3000.00"), from_node, utxo_to_spend=None, locktime=0 + self, *, fee_rate=Decimal("3000.00"), utxo_to_spend=None, locktime=0 ): """Create and return a tx with the specified fee_rate. Fee may be exact or at most one satoshi higher than needed.""" utxo_to_spend = utxo_to_spend or self.get_utxo()