diff options
author | glozow <gloriajzhao@gmail.com> | 2024-08-01 09:33:44 +0100 |
---|---|---|
committer | glozow <gloriajzhao@gmail.com> | 2024-08-01 09:48:24 +0100 |
commit | b8755164cf9ce7159837d11d19065a5fd6d7d26d (patch) | |
tree | be0872dc59ab97945181182ae7b627df6f46314d /test | |
parent | 66e82dc90c598c9c42ff980693ef5367a845e1d0 (diff) | |
parent | afd237bb5d85923273a69f7b45dc6aae6aa1680e (diff) |
Merge bitcoin/bitcoin#30413: p2p: Lazy init some bloom filters; fuzz version handshake
afd237bb5d85923273a69f7b45dc6aae6aa1680e [fuzz] Harness for version handshake (dergoegge)
a90ab4aec9cccd44d867842d6a1161d5758fcb2c scripted-diff: Rename lazily initialized bloom filters (dergoegge)
82de1bc478d54bea6125b459febfb2fb23929c61 [net processing] Lazily initialize m_recent_confirmed_transactions (dergoegge)
fa0c87f19c1eca47ee7052f3c988ff7273801ff3 [net processing] Lazily initialize m_recent_rejects_reconsiderable (dergoegge)
662e8db2d3efc651951315b295952a2eebb822cd [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:
ACK afd237bb5d85923273a69f7b45dc6aae6aa1680e
marcofleon:
Tested ACK afd237bb5d85923273a69f7b45dc6aae6aa1680e. 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:
utACK afd237bb5d85923273a69f7b45dc6aae6aa1680e lazy blooms look ok
mzumsande:
Code Review ACK afd237bb5d85923273a69f7b45dc6aae6aa1680e
Tree-SHA512: 62bba20aec0cd220e62368354891f9790b81ad75e8adf7b22a76a6d4663bd26aedc4cae8083658a75ea9043d60aad3f0e58ad36bd7bbbf93ff1d16e317bf15cc
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/mempool_reorg.py | 2 | ||||
-rwxr-xr-x | test/functional/p2p_permissions.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/test/functional/mempool_reorg.py b/test/functional/mempool_reorg.py index e27942760c..74a353ab01 100755 --- a/test/functional/mempool_reorg.py +++ b/test/functional/mempool_reorg.py @@ -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) diff --git a/test/functional/p2p_permissions.py b/test/functional/p2p_permissions.py index 5ca5101613..a9b164b078 100755 --- a/test/functional/p2p_permissions.py +++ b/test/functional/p2p_permissions.py @@ -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], |