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?

2 Answers 2


First to clarify:
Two competing blocks at the same height that build on the same parent block always have the same amount of proof of work, as that depends on the difficulty, which will be the same for both competitors.

Thus, a chain reorganization will only occur in practice if a competing chain tip pulls ahead of a previously accepted chain tip by accumulating a greater length.*

Bitcoin Core stores competing blocks it receives as a sidebranch, if the headers would potentially make it the best chain. Otherwise it discards them.

When chain reorganization occurs, Bitcoin Core will undo each block from the tip one at a time, reverting back to the common ancestor with the new best chain, then will apply the blocks in the new best chain one at a time until it is at the new tip.

* It is possible to construct a case around a difficulty change where competing chain tips have different difficulties at the same height. Then, the one with the higher difficulty would replace the one with lower difficulty at the same height. However, that would require a chain split of more than one block length.


When the client receives conflicting blockchains, the chain with the higher overall work will "win" and be the one that node A considers the true chain. If the two chains are equal (e.g. because two miners found a block at about the same time), it will hold on to both until it sees a new block on one of the chains make it the best chain. In the example you described, this is called a chain reorganization.

I'm not familiar enough with the source code to tell you exactly how it does this, but it's apparent that it does. I would assume that it does remove an orphaned chain's blocks from the disk once it knows it's orphaned.

  • 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
    Dec 2, 2014 at 4:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.