3

Let's say node is on a chain of length N+4, and receives a block from the chain of the same length N+4, but diverged by 4 blocks.

  1. Is the information of the length and accumulated difficulty broadcasted along with mined block?

  2. How will the recipient node handle this situation?

3

This phenomenon is known as a chain-split (i.e. the bitcoin network can no longer agree which chain is the canonical chain).

Nodes will be network-partitioned until one chain becomes dominant.

Therefore:

Is the information of the length and accumulated difficulty broadcasted along with mined block?

No.

How will the recipient node handle this situation?

Nodes will handle equal branches on a First Come, First Serve basis, so there will be a network partition where some nodes agree chain A with length N+4 is the canonical chain and the other set of nodes will assume chain B with length N+4 is the canonical chain. In the event of such a chain-split, the race is on for miners to produce a new block-tip and broadcast it across the bitcoin network ASAP to achieve convergence. When the contention is resolved, the node can switch to longer branch and obsolete the old branch.

  • But then, if I recieve a block that is not for the tip of my blockchain, I will reject it immediately if along I don't recieve the information that it is for the tip of some other heavier chain. I will then never switch to another chain. – croraf Oct 22 '17 at 13:15
  • Sure, but say you have adopted chain A with length N+4, and suddenly you receive a block-tip of length N+5 that mines on top of chain B, your node will immediately recognise that the block-tip you just received may belong to a longer & heavier chain, so your node will probe the peer that has sent your that block tip for all the relevant blocks. – renlord Oct 22 '17 at 13:17
  • How will my node immediately recognise it was a block for the heavier chain, and not some erroneous block for example? – croraf Oct 22 '17 at 13:18
  • But I dont know if proof of work is correct as it was made with different inputs (unknown to me). – croraf Oct 22 '17 at 13:22
  • So I looked the bitcoin core implementation and it looks like all blocks are stored so as long as they obey consensus rules. And there's a function in src/validation.cpp that activates the best chain. – renlord Oct 22 '17 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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