Compact blocks are used for efficient relay of blocks, either through High Bandwidth or Low Bandwidth mode. See BIP 152 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.