Changeset View
Changeset View
Standalone View
Standalone View
test/functional/mempool_resurrect.py
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
for tx in spends2_raw] | for tx in spends2_raw] | ||||
blocks.extend(self.nodes[0].generate(1)) | blocks.extend(self.nodes[0].generate(1)) | ||||
# mempool should be empty, all txns confirmed | # mempool should be empty, all txns confirmed | ||||
assert_equal(set(self.nodes[0].getrawmempool()), set()) | assert_equal(set(self.nodes[0].getrawmempool()), set()) | ||||
for txid in spends1_id + spends2_id: | for txid in spends1_id + spends2_id: | ||||
tx = self.nodes[0].gettransaction(txid) | tx = self.nodes[0].gettransaction(txid) | ||||
assert(tx["confirmations"] > 0) | assert tx["confirmations"] > 0 | ||||
# Use invalidateblock to re-org back; all transactions should | # Use invalidateblock to re-org back; all transactions should | ||||
# end up unconfirmed and back in the mempool | # end up unconfirmed and back in the mempool | ||||
for node in self.nodes: | for node in self.nodes: | ||||
node.invalidateblock(blocks[0]) | node.invalidateblock(blocks[0]) | ||||
# mempool should be empty, all txns confirmed | # mempool should be empty, all txns confirmed | ||||
assert_equal( | assert_equal( | ||||
set(self.nodes[0].getrawmempool()), set(spends1_id + spends2_id)) | set(self.nodes[0].getrawmempool()), set(spends1_id + spends2_id)) | ||||
for txid in spends1_id + spends2_id: | for txid in spends1_id + spends2_id: | ||||
tx = self.nodes[0].gettransaction(txid) | tx = self.nodes[0].gettransaction(txid) | ||||
assert(tx["confirmations"] == 0) | assert tx["confirmations"] == 0 | ||||
# Generate another block, they should all get mined | # Generate another block, they should all get mined | ||||
self.nodes[0].generate(1) | self.nodes[0].generate(1) | ||||
# mempool should be empty, all txns confirmed | # mempool should be empty, all txns confirmed | ||||
assert_equal(set(self.nodes[0].getrawmempool()), set()) | assert_equal(set(self.nodes[0].getrawmempool()), set()) | ||||
for txid in spends1_id + spends2_id: | for txid in spends1_id + spends2_id: | ||||
tx = self.nodes[0].gettransaction(txid) | tx = self.nodes[0].gettransaction(txid) | ||||
assert(tx["confirmations"] > 0) | assert tx["confirmations"] > 0 | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
MempoolCoinbaseTest().main() | MempoolCoinbaseTest().main() |