mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-20 04:36:08 +01:00
test: Add test for erase orphan tx from peer
This commit is contained in:
@@ -60,7 +60,6 @@ class InvalidTxRequestTest(BitcoinTestFramework):
|
||||
block.solve()
|
||||
# Save the coinbase for later
|
||||
block1 = block
|
||||
tip = block.sha256
|
||||
node.p2ps[0].send_blocks_and_test([block], node, success=True)
|
||||
|
||||
self.log.info("Mature the block.")
|
||||
@@ -157,6 +156,7 @@ class InvalidTxRequestTest(BitcoinTestFramework):
|
||||
with node.assert_debug_log(['orphanage overflow, removed 1 tx']):
|
||||
node.p2ps[0].send_txs_and_test(orphan_tx_pool, node, success=False)
|
||||
|
||||
self.log.info('Test orphan with rejected parents')
|
||||
rejected_parent = CTransaction()
|
||||
rejected_parent.vin.append(CTxIn(outpoint=COutPoint(tx_orphan_2_invalid.sha256, 0)))
|
||||
rejected_parent.vout.append(CTxOut(nValue=11 * COIN, scriptPubKey=SCRIPT_PUB_KEY_OP_TRUE))
|
||||
@@ -164,6 +164,10 @@ class InvalidTxRequestTest(BitcoinTestFramework):
|
||||
with node.assert_debug_log(['not keeping orphan with rejected parents {}'.format(rejected_parent.hash)]):
|
||||
node.p2ps[0].send_txs_and_test([rejected_parent], node, success=False)
|
||||
|
||||
self.log.info('Test that a peer disconnection causes erase its transactions from the orphan pool')
|
||||
with node.assert_debug_log(['Erased 100 orphan tx from peer=25']):
|
||||
self.reconnect_p2p(num_connections=1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
InvalidTxRequestTest().main()
|
||||
|
||||
Reference in New Issue
Block a user