Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-mempool-coherence-on-activations.py
Show First 20 Lines • Show All 245 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
bfork.nTime = ACTIVATION_TIME - 1 | bfork.nTime = ACTIVATION_TIME - 1 | ||||
update_block(5555, [txfund0, txfund1, txfund2, txfund3]) | update_block(5555, [txfund0, txfund1, txfund2, txfund3]) | ||||
node.p2p.send_blocks_and_test([self.tip], node) | node.p2p.send_blocks_and_test([self.tip], node) | ||||
for i in range(5): | for i in range(5): | ||||
node.p2p.send_blocks_and_test([block(5200 + i)], node) | node.p2p.send_blocks_and_test([block(5200 + i)], node) | ||||
# Check we are just before the activation time | # Check we are just before the activation time | ||||
assert_equal(node.getblockheader(node.getbestblockhash())['mediantime'], | assert_equal( | ||||
node.getblockchaininfo()['mediantime'], | |||||
ACTIVATION_TIME - 1) | ACTIVATION_TIME - 1) | ||||
# We are just before the fork. Pre-fork-only and always-valid chained | # We are just before the fork. Pre-fork-only and always-valid chained | ||||
# txns (tx_chain0, tx_chain1) are valid, post-fork-only txns are | # txns (tx_chain0, tx_chain1) are valid, post-fork-only txns are | ||||
# rejected. | # rejected. | ||||
send_transaction_to_mempool(tx_pre0) | send_transaction_to_mempool(tx_pre0) | ||||
send_transaction_to_mempool(tx_pre1) | send_transaction_to_mempool(tx_pre1) | ||||
tx_chain0, last_chained_output = create_always_valid_chained_tx(out[4]) | tx_chain0, last_chained_output = create_always_valid_chained_tx(out[4]) | ||||
tx_chain1, last_chained_output = create_always_valid_chained_tx( | tx_chain1, last_chained_output = create_always_valid_chained_tx( | ||||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
tip(5204) | tip(5204) | ||||
reorg_blocks = [] | reorg_blocks = [] | ||||
for i in range(3): | for i in range(3): | ||||
reorg_blocks.append(block(5900 + i)) | reorg_blocks.append(block(5900 + i)) | ||||
# Perform the reorg | # Perform the reorg | ||||
node.p2p.send_blocks_and_test(reorg_blocks, node) | node.p2p.send_blocks_and_test(reorg_blocks, node) | ||||
# reorg finishes after the fork | # reorg finishes after the fork | ||||
assert_equal(node.getblockheader(node.getbestblockhash())['mediantime'], | assert_equal( | ||||
node.getblockchaininfo()['mediantime'], | |||||
ACTIVATION_TIME + 2) | ACTIVATION_TIME + 2) | ||||
# In old mempool: tx_chain2, tx_post1 | # In old mempool: tx_chain2, tx_post1 | ||||
# Recovered from blocks: tx_chain0, tx_chain1, tx_post0 | # Recovered from blocks: tx_chain0, tx_chain1, tx_post0 | ||||
# Lost from blocks: tx_pre0 | # Lost from blocks: tx_pre0 | ||||
# Retained from old mempool: tx_chain2, tx_post1 | # Retained from old mempool: tx_chain2, tx_post1 | ||||
# Evicted from old mempool: NONE | # Evicted from old mempool: NONE | ||||
check_mempool_equal( | check_mempool_equal( | ||||
[tx_chain0, tx_chain1, tx_chain2, tx_post0, tx_post1]) | [tx_chain0, tx_chain1, tx_chain2, tx_post0, tx_post1]) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
MempoolCoherenceOnActivationsTest().main() | MempoolCoherenceOnActivationsTest().main() |