Author

Topic: Compact Blocks: How are blocks validated in high bandwidth mode? (Read 570 times)

newbie
Activity: 16
Merit: 7
Great explanation! Thank you!
staff
Activity: 3458
Merit: 6793
Just writing some code
Thank you for the reply.  A follow up then, how are the compact blocks uncompressed (if you get relayed a cmpctblock)?
The compact block contains shortened versions of the transaction ids in a block. The node, when it receives the cmpctblock message, will calculate the shortened txids of all of the transactions that it has in its mempool. It retrieves the transactions that have matching shortened txids from the mempool in order to rebuild the full block. If it cannot find a transaction, it will request it from the peer that sent it the cmpctblock message. In this way the block is relayed without needing to actually send all of the data for the block when the block is relayed; most, if not all, of the transactions in the block will likely be found in the node's mempool and can be rebuilt from there.
newbie
Activity: 16
Merit: 7
Thank you for the reply.  A follow up then, how are the compact blocks uncompressed (if you get relayed a cmpctblock)?
staff
Activity: 3458
Merit: 6793
Just writing some code
No. The partially validated block may propagate but nodes will still validate it fully and then reject the block if it is invalid. Relaying a block before validation does not mean that the block will never be validated by the node; the node will still validate it fully.
newbie
Activity: 16
Merit: 7
Hi! Quick clarifying question.

Compact blocks can be used in both high-bandwidth mode and low-bandwidth mode. In high-bandwidth mode, peer A (sending to B) validates just the block header then relays cmpctblock.

My question is what if the rest of the block is invalid? If the majority of the network was using compact blocks in high-bandwidth mode, wouldn't this mean many only partially validated blocks circulating the network?

Thanks!
Jump to: