Author

Topic: Sending large blocks (Read 942 times)

legendary
Activity: 1232
Merit: 1094
November 08, 2014, 07:38:31 PM
#1
In the bitcoin network protocol, messages are limited to 32MB.  The entire message is stored in RAM before processing, in order to compute the CRC.

If the block size is increased past 32MB, then one block won't be able to fit into message anymore.

This means that blocks need to be partitioned over multiple messages and ideally, the receiving node should be able to check each sub-block is valid before receiving the next sub-block.  This prevents sending a node a huge block and then at the end it turns out that it was a difficulty 1 block.

The merkleblock message already achieves this.  The reference client would just need to be able to combine multiple merkle blocks together to make one block.

Extra fields could be added to the merkle block to help manage the process.

Field SizeDescriptionData typeComments
?block_sizevar_intThe size of the block in bytes
?sub_block_positionvar_intThe position of the first transaction in the block
?sub_block_indexvar_intThe index of the sub block
?sub_block_countvar_intThe number of the sub blocks for the block

If all the fields are set to zero, then it means that it is an independent merkle block.  Otherwise, a block is being broken down into pieces. 

When sending partitioned blocks, the rule would be that the transactions have to be in sequence.  The recipient could create a large array and would know where to copy the transactions. 

This would allow out of order merkleblocks.
Jump to: