Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_opportunistic_1p1c.py
| Show First 20 Lines • Show All 277 Lines • ▼ Show 20 Lines | def test_orphan_consensus_failure(self): | ||||
| # package and rejected. | # package and rejected. | ||||
| parent_sender.send_message(msg_tx(low_fee_parent["tx"])) | parent_sender.send_message(msg_tx(low_fee_parent["tx"])) | ||||
| # 4. Transactions should not be in mempool. | # 4. Transactions should not be in mempool. | ||||
| node_mempool = node.getrawmempool() | node_mempool = node.getrawmempool() | ||||
| assert low_fee_parent["txid"] not in node_mempool | assert low_fee_parent["txid"] not in node_mempool | ||||
| assert tx_orphan_bad_sig.txid_hex not in node_mempool | assert tx_orphan_bad_sig.txid_hex not in node_mempool | ||||
| # 5. Peer that sent a consensus-invalid transaction should be | # The bad orphan sender should not be disconnected. | ||||
| # disconnected. | bad_orphan_sender.sync_with_ping() | ||||
| bad_orphan_sender.wait_for_disconnect() | |||||
| # The peer that didn't provide the orphan should not be disconnected. | # The peer that didn't provide the orphan should not be disconnected. | ||||
| parent_sender.sync_with_ping() | parent_sender.sync_with_ping() | ||||
| @cleanup | @cleanup | ||||
| def test_parent_consensus_failure(self): | def test_parent_consensus_failure(self): | ||||
| self.log.info( | self.log.info( | ||||
| "Check opportunistic 1p1c logic with consensus-invalid parent causes disconnect of the correct peer" | "Check opportunistic 1p1c logic with consensus-invalid parent causes disconnect of the correct peer" | ||||
| Show All 32 Lines | def test_parent_consensus_failure(self): | ||||
| fake_parent_sender.send_message(msg_tx(tx_parent_bad_sig)) | fake_parent_sender.send_message(msg_tx(tx_parent_bad_sig)) | ||||
| # 4. Transactions should not be in mempool. | # 4. Transactions should not be in mempool. | ||||
| node_mempool = node.getrawmempool() | node_mempool = node.getrawmempool() | ||||
| assert tx_parent_bad_sig.txid_hex not in node_mempool | assert tx_parent_bad_sig.txid_hex not in node_mempool | ||||
| assert high_fee_child["txid"] not in node_mempool | assert high_fee_child["txid"] not in node_mempool | ||||
| # 5. Peer sent a consensus-invalid transaction. | # 5. Peer sent a consensus-invalid transaction. | ||||
| fake_parent_sender.wait_for_disconnect() | fake_parent_sender.sync_with_ping() | ||||
| self.log.info( | self.log.info( | ||||
| "Check that fake parent does not cause orphan to be deleted and real package can still be submitted" | "Check that fake parent does not cause orphan to be deleted and real package can still be submitted" | ||||
| ) | ) | ||||
| # 6. Child-sending should not have been punished and the orphan should | # 6. Child-sending should not have been punished and the orphan should | ||||
| # remain in orphanage. | # remain in orphanage. | ||||
| # Note: this test case differs from core because we have no tx | # Note: this test case differs from core because we have no tx | ||||
| # malleability that would allow for creating a valid tx with the same | # malleability that would allow for creating a valid tx with the same | ||||
| ▲ Show 20 Lines • Show All 153 Lines • Show Last 20 Lines | |||||