mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-31 08:13:52 +02:00
Merge bitcoin/bitcoin#30413: p2p: Lazy init some bloom filters; fuzz version handshake
afd237bb5d[fuzz] Harness for version handshake (dergoegge)a90ab4aec9scripted-diff: Rename lazily initialized bloom filters (dergoegge)82de1bc478[net processing] Lazily initialize m_recent_confirmed_transactions (dergoegge)fa0c87f19c[net processing] Lazily initialize m_recent_rejects_reconsiderable (dergoegge)662e8db2d3[net processing] Lazily initialize m_recent_rejects (dergoegge) Pull request description: This adds a fuzzing harness dedicated to the version handshake. To avoid determinism issues, the harness creates necessary components each iteration (addrman, peerman, etc). A harness like this would have easily caught https://bitcoincore.org/en/2024/07/03/disclose-timestamp-overflow/. As a performance optimization, this PR includes a change to `PeerManager` to lazily initialize various filters (to avoid large unnecessary memory allocations each iteration). ACKs for top commit: brunoerg: ACKafd237bb5dmarcofleon: Tested ACKafd237bb5d. I compared the coverage of `net_processing` from this harness to the `process_message` and `process_messages` harnesses to see the differences. This target hits more specific parts of the version handshake. The stability looks good as well, at about 94%. glozow: utACKafd237bb5dlazy blooms look ok mzumsande: Code Review ACKafd237bb5dTree-SHA512: 62bba20aec0cd220e62368354891f9790b81ad75e8adf7b22a76a6d4663bd26aedc4cae8083658a75ea9043d60aad3f0e58ad36bd7bbbf93ff1d16e317bf15cc
This commit is contained in:
@@ -162,7 +162,7 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
|
||||
self.log.info("Generate a block")
|
||||
last_block = self.generate(self.nodes[0], 1)
|
||||
# generate() implicitly syncs blocks, so that peer 1 gets the block before timelock_tx
|
||||
# Otherwise, peer 1 would put the timelock_tx in m_recent_rejects
|
||||
# Otherwise, peer 1 would put the timelock_tx in m_lazy_recent_rejects
|
||||
|
||||
self.log.info("The time-locked transaction can now be spent")
|
||||
timelock_tx_id = self.nodes[0].sendrawtransaction(timelock_tx)
|
||||
|
||||
@@ -121,7 +121,7 @@ class P2PPermissionsTests(BitcoinTestFramework):
|
||||
tx.vout[0].nValue += 1
|
||||
txid = tx.rehash()
|
||||
# Send the transaction twice. The first time, it'll be rejected by ATMP because it conflicts
|
||||
# with a mempool transaction. The second time, it'll be in the m_recent_rejects filter.
|
||||
# with a mempool transaction. The second time, it'll be in the m_lazy_recent_rejects filter.
|
||||
p2p_rebroadcast_wallet.send_txs_and_test(
|
||||
[tx],
|
||||
self.nodes[1],
|
||||
|
||||
Reference in New Issue
Block a user