mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-01 16:31:33 +01:00
Merge bitcoin/bitcoin#22340: p2p: Use legacy relaying to download blocks in blocks-only mode
18c5b23a0f[test] Test that -blocksonly nodes still serve compact blocks. (Niklas Gögge)a79ad65fc2[test] Test that getdata(CMPCT) is still sent on regular low bandwidth connections. (Niklas Gögge)5e231c116b[test] Test that -blocksonly nodes do not send getdata(CMPCT) on a low bandwidth connection. (Niklas Gögge)5bf6587457[test] Test that -blocksonly nodes do not request high bandwidth mode. (Niklas Gögge)0dc8bf5b92[net processing] Dont request compact blocks in blocks-only mode (Niklas Gögge) Pull request description: A blocks-only node does not participate in transaction relay to reduce its own bandwidth usage and therefore does not have a mempool. The use of compact blocks is not beneficial to such a node since it will always have to download full blocks. In both high- and low-bandwidth relaying the `cmpctblock` message is sent. This represent a bandwidth overhead for blocks-only nodes because the `cmpctblock` message is several times larger in the average case than the equivalent `headers` or `inv` announcement.  >**Example:** >A block with 2000 txs results in a `cmpctblock` with 2000*6 bytes in short ids. This is several times larger than the equivalent 82 bytes for a `headers` message or 37 bytes for an `inv`. ## Approach This PR makes blocks-only nodes always use the legacy relaying to download new blocks. It does so by making blocks-only nodes never initiate a high-bandwidth block relay connection by disabling the sending of `sendcmpct(1)`. Additionally a blocks-only node will never request a compact block using `getdata(CMPCT)`. A blocks-only node will continue to serve compact blocks to its peers in both high- and low-bandwidth mode. ACKs for top commit: naumenkogs: ACK18c5b23a0frajarshimaitra: tACK18c5b23a0fjnewbery: reACK18c5b23a0ftheStack: re-ACK18c5b23a0f🥛 Tree-SHA512: 0c78804aa397513d41f97fe314efb815efcd852d452dd903df9d4749280cd3faaa010fa9b51d7d5168b8a77e08c8ab0a491ecdbdb3202f2e9cd5137cddc74624
This commit is contained in:
@@ -98,6 +98,7 @@ BASE_SCRIPTS = [
|
||||
'rpc_fundrawtransaction.py --legacy-wallet',
|
||||
'rpc_fundrawtransaction.py --descriptors',
|
||||
'p2p_compactblocks.py',
|
||||
'p2p_compactblocks_blocksonly.py',
|
||||
'feature_segwit.py --legacy-wallet',
|
||||
# vv Tests less than 2m vv
|
||||
'wallet_basic.py --legacy-wallet',
|
||||
|
||||
Reference in New Issue
Block a user