Skip to content

Commit 6697a70

Browse files
committed
add test for unconfirmed balance between restarts
1 parent 6ba8f30 commit 6697a70

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/functional/mempool_persist.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,27 @@ def run_test(self):
5757
self.log.debug("Send 5 transactions from node2 (to its own address)")
5858
for i in range(5):
5959
self.nodes[2].sendtoaddress(self.nodes[2].getnewaddress(), Decimal("10"))
60+
node2_balance = self.nodes[2].getbalance()
6061
self.sync_all()
6162

6263
self.log.debug("Verify that node0 and node1 have 5 transactions in their mempools")
6364
assert_equal(len(self.nodes[0].getrawmempool()), 5)
6465
assert_equal(len(self.nodes[1].getrawmempool()), 5)
6566

66-
self.log.debug("Stop-start node0 and node1. Verify that node0 has the transactions in its mempool and node1 does not.")
67+
self.log.debug("Stop-start the nodes. Verify that node0 has the transactions in its mempool and node1 does not. Verify that node2 calculates its balance correctly after loading wallet transactions.")
6768
self.stop_nodes()
6869
self.start_node(0)
6970
self.start_node(1)
71+
self.start_node(2)
7072
# Give bitcoind a second to reload the mempool
7173
time.sleep(1)
7274
wait_until(lambda: len(self.nodes[0].getrawmempool()) == 5)
75+
wait_until(lambda: len(self.nodes[2].getrawmempool()) == 5)
7376
assert_equal(len(self.nodes[1].getrawmempool()), 0)
7477

78+
# Verify accounting of mempool transactions after restart is correct
79+
assert_equal(node2_balance, self.nodes[2].getbalance())
80+
7581
self.log.debug("Stop-start node0 with -persistmempool=0. Verify that it doesn't load its mempool.dat file.")
7682
self.stop_nodes()
7783
self.start_node(0, extra_args=["-persistmempool=0"])

0 commit comments

Comments
 (0)