How does the network know the legitimate chain in a double-spend attempt?
Imagine the blockchain as... a chain of blocks

The situation is:

A -&gt; B -&gt; C
      \-&gt; C'


But some nodes see it as  A -> B -> C and mine over the block C

and some other see A -> B -> C' and mine over the block C'

If node sees something like this:

A -&gt; B -&gt; C -&gt; D -&gt; E...
      \-&gt; C'-&gt; D'-&gt; E'...


it should select the chain with larger cumulative difficulty (longest) and forget anything about orphan chain