Conflict resolution
Although selecting a block may seem an obvious task, there will be situations when two or more nodes create a block at the same time that has different identities due to the different content included in its block. When a node receives different versions of a block of the same height, it will add one of them to the blockchain based on the order of arrival and either rejects the other or keeps it in a memory pool. Due to this, nodes in the network might end up with different versions of the blockchain. This is called a temporary fork or a soft fork.
Figure 4.2 shows how two blockchains have been created due to the simultaneous creation of blocks of the same height. Both the blockchains have the same height and the same blocks, up to index 11. But there are two different versions of block 12. As we can see in the figure, one of the blocks has a hash that ends with ...bfa9779618ff, and the other hash ends with ...bce8564de9a8. Both blocks are valid because their previous hash value matches with the previous block's hash, ...ea758a8134b1. At this stage, one of the blocks will be inserted into the main chain, and the other will be rejected.
Although the conflict has been resolved on one node, there will be no global truth of the blockchain throughout the network because other nodes may have decided to accept a different block. This will create a temporary fork in the blockchain, because some nodes have one version of the blockchain, and some have the other version.
This temporary fork will not survive for a long time. As soon as a longer blockchain is created, and when a new block is appended to one of the chains, every node will reject the smaller blockchain and replace their blockchain with the longer one. Figure 4.3 shows how the blockchain with the hash value ...bce8564de9a8 at index 12 will be accepted as it has increased its blockchain with an additional block, thus forming a longer chain.