mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-25 07:51:08 +02:00
qa: test cached failure for compact block
Submit the block with an invalid transaction Script again, leading to CACHED_INVALID being returned by AcceptBlockHeader(). Ensure that also this code path does not lead to a disconnection. This was previously untested, as can be checked with the following diff: ```diff diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 0c4a89c44cb..e8e0c805367 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1814,10 +1814,10 @@ void PeerManagerImpl::MaybePunishNodeForBlock(NodeId nodeid, const BlockValidati { // Discourage outbound (but not inbound) peers if on an invalid chain. // Exempt HB compact block peers. Manual connections are always protected from discouragement. - if (peer && !via_compact_block && !peer->m_is_inbound) { + //if (peer && !via_compact_block && !peer->m_is_inbound) { if (peer) Misbehaving(*peer, message); return; - } + //} break; } case BlockValidationResult::BLOCK_INVALID_HEADER: ```
This commit is contained in:
@@ -744,6 +744,13 @@ class CompactBlocksTest(BitcoinTestFramework):
|
|||||||
assert_not_equal(node.getbestblockhash(), block.hash_hex)
|
assert_not_equal(node.getbestblockhash(), block.hash_hex)
|
||||||
test_node.sync_with_ping()
|
test_node.sync_with_ping()
|
||||||
|
|
||||||
|
# The failure above was cached. Submitting the compact block again will returned a cached
|
||||||
|
# consensus error (the code path is different) and still not get us disconnected (nor
|
||||||
|
# advance the tip).
|
||||||
|
test_node.send_and_ping(msg)
|
||||||
|
assert_not_equal(node.getbestblockhash(), block.hash_hex)
|
||||||
|
test_node.sync_with_ping()
|
||||||
|
|
||||||
# Helper for enabling cb announcements
|
# Helper for enabling cb announcements
|
||||||
# Send the sendcmpct request and sync headers
|
# Send the sendcmpct request and sync headers
|
||||||
def request_cb_announcements(self, peer):
|
def request_cb_announcements(self, peer):
|
||||||
|
Reference in New Issue
Block a user