Skip to content

Commit

Permalink
Merge bitcoin#25955: test: use sendall when emptying wallet
Browse files Browse the repository at this point in the history
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@28ea4c7

Tree-SHA512: 903136d7df5c65d3c02310d5a84241c9fd11070f69d932b4e188b8ad45c38ab5bc1bd5a9242b3e52d2576665ead14be0a03971a9ad8c00431fed442eba4ca48f
  • Loading branch information
MacroFake authored and vijaydasmp committed Feb 5, 2025
1 parent b396512 commit 4d61fb7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions test/functional/rpc_fundrawtransaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ def test_many_inputs_fee(self):
self.log.info("Test fundrawtxn fee with many inputs")

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

for _ in range(20):
Expand All @@ -595,7 +595,7 @@ def test_many_inputs_send(self):
self.log.info("Test fundrawtxn sign+send with many inputs")

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

for _ in range(20):
Expand Down
10 changes: 2 additions & 8 deletions test/functional/wallet_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,15 +622,9 @@ def run_test(self):

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

# Get all non-zero utxos together
# Get all non-zero utxos together and split into two chains
chain_addrs = [self.nodes[0].getnewaddress(), self.nodes[0].getnewaddress()]
singletxid = self.nodes[0].sendtoaddress(chain_addrs[0], self.nodes[0].getbalance(), "", "", True)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
node0_balance = self.nodes[0].getbalance()
# Split into two chains
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')})
signedtx = self.nodes[0].signrawtransactionwithwallet(rawtx)
singletxid = self.nodes[0].sendrawtransaction(hexstring=signedtx["hex"], maxfeerate=0)
self.nodes[0].sendall(recipients=chain_addrs)
self.generate(self.nodes[0], 1, sync_fun=self.no_op)

# Make a long chain of unconfirmed payments without hitting mempool limit
Expand Down
2 changes: 1 addition & 1 deletion test/functional/wallet_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def run_test(self):
assert_equal(2, len(tx6["vout"]))

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

Expand Down

0 comments on commit 4d61fb7

Please sign in to comment.