Changeset View
Changeset View
Standalone View
Standalone View
test/functional/mempool_persist.py
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
assert_equal(len(self.nodes[0].getrawmempool()), 5) | assert_equal(len(self.nodes[0].getrawmempool()), 5) | ||||
assert_equal(len(self.nodes[1].getrawmempool()), 5) | assert_equal(len(self.nodes[1].getrawmempool()), 5) | ||||
self.log.debug("Stop-start the nodes. Verify that node0 has the " | self.log.debug("Stop-start the nodes. Verify that node0 has the " | ||||
"transactions in its mempool and node1 does not. " | "transactions in its mempool and node1 does not. " | ||||
"Verify that node2 calculates its balance correctly " | "Verify that node2 calculates its balance correctly " | ||||
"after loading wallet transactions.") | "after loading wallet transactions.") | ||||
self.stop_nodes() | self.stop_nodes() | ||||
self.start_node(0) | # Give this one a head-start, so we can be "extra-sure" that it didn't load anything later | ||||
self.start_node(1) | self.start_node(1) | ||||
self.start_node(0) | |||||
self.start_node(2) | self.start_node(2) | ||||
# Give bitcoind a second to reload the mempool | # Give bitcoind a second to reload the mempool | ||||
time.sleep(1) | wait_until(lambda: len(self.nodes[0].getrawmempool()) == 5, timeout=1) | ||||
wait_until(lambda: len(self.nodes[0].getrawmempool()) == 5) | wait_until(lambda: len(self.nodes[2].getrawmempool()) == 5, timeout=1) | ||||
wait_until(lambda: len(self.nodes[2].getrawmempool()) == 5) | # The others have loaded their mempool. If node_1 loaded anything, we'd probably notice by now: | ||||
assert_equal(len(self.nodes[1].getrawmempool()), 0) | assert_equal(len(self.nodes[1].getrawmempool()), 0) | ||||
# Verify accounting of mempool transactions after restart is correct | # Verify accounting of mempool transactions after restart is correct | ||||
# Flush mempool to wallet | |||||
self.nodes[2].syncwithvalidationinterfacequeue() | |||||
assert_equal(node2_balance, self.nodes[2].getbalance()) | assert_equal(node2_balance, self.nodes[2].getbalance()) | ||||
self.log.debug( | self.log.debug( | ||||
"Stop-start node0 with -persistmempool=0. Verify that it doesn't load its mempool.dat file.") | "Stop-start node0 with -persistmempool=0. Verify that it doesn't load its mempool.dat file.") | ||||
self.stop_nodes() | self.stop_nodes() | ||||
self.start_node(0, extra_args=["-persistmempool=0"]) | self.start_node(0, extra_args=["-persistmempool=0"]) | ||||
# Give bitcoind a second to reload the mempool | # Give bitcoind a second to reload the mempool | ||||
time.sleep(1) | time.sleep(1) | ||||
Show All 39 Lines |