2
Node A receives a newest block with height h1, which it determines to be valid, and therefore stores the block on disk. A little later, it receives another block with the same height h1 but a greater amount of proof of work than the previous one. What would node A do?
Also I am confused about the order of processing a new block. The order in the source code:
success success
Check(block)----------->store block on disk------------------>ReceivedBlockTransaction-------->ActivateBestChain
If ReceivedBlockTransaction or ActivateBestChain were to fail, would the disk be rolled back or not? If it would rollback, why not put the receivedBlockTransaction and ActivateBestchain before store block on disk?
Hi Tim,Thank your answer. I think processing block is a serial not parallel.One node must process one by one and increment its mainchain height. So if there are two same height new blocks(A and B), nodes would store the block that the node first get(A) and add its height by 1. when the node found B, its mainchain height is already higher than block B, so it won't accept B. But if some time later the node found a chain is longer than its mainchain and the chain maybe is forked by B, the node will reorganize. My point is the node won't hold on both the same height blocks. Am I right? – Eleven – 2014-12-02T04:28:11.097