diff options
author | fanquake <fanquake@gmail.com> | 2022-05-16 12:40:38 +0100 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2022-05-16 12:41:09 +0100 |
commit | dc0ee573734ed49c054bfa3b97f1785c755dd0c3 (patch) | |
tree | 2445a61ae884be58f417beca92d89401e94e9a02 /src/random.cpp | |
parent | 1511c9efb40524615ed47cc4e38af0735d536575 (diff) | |
parent | a50e34c367608fcec9697893981bfa294a7c08d1 (diff) | |
download | bitcoin-dc0ee573734ed49c054bfa3b97f1785c755dd0c3.tar.xz |
Merge bitcoin/bitcoin#20799: net processing: Only support version 2 compact blocks
a50e34c367608fcec9697893981bfa294a7c08d1 [net processing] Remove redundant nodestate->m_sendcmpct check in MaybeSetPeerAsAnnouncingHeaderAndIDs() (John Newbery)
bb985a7b6abee503852c61eec74ca3a29f582815 [net processing] Only relay blocks by cmpctblock and cache for fast relay if segwit is enabled (John Newbery)
3b6bfbce386f61dcbb366f08cfff55c3882f429c [net processing] Rename CNodeState compact block members (John Newbery)
d0e97741748aaaad2a89ca42e4898e7f01308b35 [net processing] Tidy up `sendcmpct` processing (John Newbery)
30c3a01874cf51d987a0ae2bb699bf50d82768ff [net processing] fPreferHeaderAndIDs implies fProvidesHeaderAndIDs (John Newbery)
b486f721767d07c1e2eaf8deaf96b732b0a858dd [net processing] Remove fWantsCmpctWitness (John Newbery)
a45d53cab556505048c387429fd07188e4c40c3d [net processing] Remove fSupportsDesiredCmpctVersion (John Newbery)
25edb2b7bd4c41156fba09d0033a978e362435af [net processing] Simplify `sendcmpct` processing (John Newbery)
42882fc8fc2ef5c58eb963f7f1e852dd43de6c65 [net processing] Only accept `sendcmpct` with version=2 (John Newbery)
16730b64bb4a11995d792f626c8a63318e5eaeeb [net processing] Only advertise support for version 2 compact blocks (John Newbery)
cba909eaf938a775a9bd2dd994d06aba175e8713 [net] Stop testing version 1 compact blocks. (John Newbery)
Pull request description:
Compact blocks are used for efficient relay of blocks, either through High Bandwidth or Low Bandwidth mode. See [BIP 152](https://github.com/bitcoin/bips/blob/master/bip-0152.mediawiki) for full details.
For compact block relay to work, the receiver must have a mempool containing transactions which are likely to be included in the block. The receiver uses these transactions to reconstruct the block from the short transaction ids included in the `cmpctblock` message. Compact blocks are therefore only useful for relaying blocks at or near the tip of the block chain. For older blocks, the recipient won't have the transactions in their mempool and so would need to request them using a `getblocktxn` message. In such cases, just requesting the full block is more efficient.
BIP 152 supports two versions: version 1 (without witnesses) and version 2 (with witnesses). Version 2 is required to reconstruct segwit blocks. Segwit was activated in August 2017, and providing non-witness blocks to peers is no longer useful. Since the witnesses are not included, the peer would not be able to fully validate all the consensus rules on the provided block.
Therefore, stop supporting version 1 compact blocks. Ignore `sendcmpct` messages with version=1, and don't advertise support by sending `sendcmpct` with version=1. Only send `sendcmpct` to peers with `NODE_WITNESS`. Respond to all requests for compact blocks or blocktxns with witness-serialized blocks and transactions.
ACKs for top commit:
dergoegge:
ACK a50e34c367608fcec9697893981bfa294a7c08d1 - Only changes since my last review were a rebase and some nits.
MarcoFalke:
re-ACK a50e34c367608fcec9697893981bfa294a7c08d after rebase 👓
Tree-SHA512: 8ad73acaa374d56ee9f28ca0a9d64b8630793d22fc8c942a1ee15551d4d80f76f3ba937682f85f22ec8ca82efae98a92de75a7e2f5a97499d8f9c7e4f2833c86
Diffstat (limited to 'src/random.cpp')
0 files changed, 0 insertions, 0 deletions