Skip to content

Commit d16ef40

Browse files
author
MacroFake
committed
Merge bitcoin/bitcoin#25955: test: use sendall when emptying wallet
28ea4c7 test: simplify splitment with `sendall` in wallet_basic (brunoerg) 923d245 test: use `sendall` when emptying wallet (brunoerg) Pull request description: In some tests they have used `sendtoaddress` in order to empty a wallet. With the addition of `sendall`, it makes sense to use it for that. ACKs for top commit: achow101: ACK 28ea4c7 ishaanam: utACK 28ea4c7 w0xlt: ACK bitcoin/bitcoin@28ea4c7 Tree-SHA512: 903136d7df5c65d3c02310d5a84241c9fd11070f69d932b4e188b8ad45c38ab5bc1bd5a9242b3e52d2576665ead14be0a03971a9ad8c00431fed442eba4ca48f
2 parents 52dcb1d + 28ea4c7 commit d16ef40

File tree

4 files changed

+6
-12
lines changed

4 files changed

+6
-12
lines changed

test/functional/rpc_fundrawtransaction.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ def test_many_inputs_fee(self):
635635
self.log.info("Test fundrawtxn fee with many inputs")
636636

637637
# Empty node1, send some small coins from node0 to node1.
638-
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), self.nodes[1].getbalance(), "", "", True)
638+
self.nodes[1].sendall(recipients=[self.nodes[0].getnewaddress()])
639639
self.generate(self.nodes[1], 1)
640640

641641
for _ in range(20):
@@ -661,7 +661,7 @@ def test_many_inputs_send(self):
661661
self.log.info("Test fundrawtxn sign+send with many inputs")
662662

663663
# Again, empty node1, send some small coins from node0 to node1.
664-
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), self.nodes[1].getbalance(), "", "", True)
664+
self.nodes[1].sendall(recipients=[self.nodes[0].getnewaddress()])
665665
self.generate(self.nodes[1], 1)
666666

667667
for _ in range(20):

test/functional/wallet_basic.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -585,15 +585,9 @@ def run_test(self):
585585

586586
# ==Check that wallet prefers to use coins that don't exceed mempool limits =====
587587

588-
# Get all non-zero utxos together
588+
# Get all non-zero utxos together and split into two chains
589589
chain_addrs = [self.nodes[0].getnewaddress(), self.nodes[0].getnewaddress()]
590-
singletxid = self.nodes[0].sendtoaddress(chain_addrs[0], self.nodes[0].getbalance(), "", "", True)
591-
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
592-
node0_balance = self.nodes[0].getbalance()
593-
# Split into two chains
594-
rawtx = self.nodes[0].createrawtransaction([{"txid": singletxid, "vout": 0}], {chain_addrs[0]: node0_balance / 2 - Decimal('0.01'), chain_addrs[1]: node0_balance / 2 - Decimal('0.01')})
595-
signedtx = self.nodes[0].signrawtransactionwithwallet(rawtx)
596-
singletxid = self.nodes[0].sendrawtransaction(hexstring=signedtx["hex"], maxfeerate=0)
590+
self.nodes[0].sendall(recipients=chain_addrs)
597591
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
598592

599593
# Make a long chain of unconfirmed payments without hitting mempool limit

test/functional/wallet_bumpfee.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ def test_no_more_inputs_fails(self, rbf_node, dest_address):
624624
# feerate rbf requires confirmed outputs when change output doesn't exist or is insufficient
625625
self.generatetoaddress(rbf_node, 1, dest_address)
626626
# spend all funds, no change output
627-
rbfid = rbf_node.sendtoaddress(rbf_node.getnewaddress(), rbf_node.getbalance(), "", "", True)
627+
rbfid = rbf_node.sendall(recipients=[rbf_node.getnewaddress()])['txid']
628628
assert_raises_rpc_error(-4, "Unable to create transaction. Insufficient funds", rbf_node.bumpfee, rbfid)
629629
self.clear_mempool()
630630

test/functional/wallet_groups.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def run_test(self):
154154
assert_equal(2, len(tx6["vout"]))
155155

156156
# Empty out node2's wallet
157-
self.nodes[2].sendtoaddress(address=self.nodes[0].getnewaddress(), amount=self.nodes[2].getbalance(), subtractfeefromamount=True)
157+
self.nodes[2].sendall(recipients=[self.nodes[0].getnewaddress()])
158158
self.sync_all()
159159
self.generate(self.nodes[0], 1)
160160

0 commit comments

Comments
 (0)