0

I know orphan blocks can occur naturally when two miners produce blocks at similar times. in bitcore-node, How does this handled? for example, when orphan block occur in node, does bitcore change blockHeight in transactions table?

  • You might be thinking of stale blocks. Orphan blocks have no parents, and don't occur anymore since headers first synchronization. – pinhead Jan 7 at 17:30
  • Conceptually, every full node only has one "main" chain. There is only one block at each height in that chain. – pinhead Jan 7 at 17:37
  • Oh, I just realized that you mention Bitcore, not Bitcoin Core. If that was on purpose, my answer is probably obsolete, because I wrote about Bitcoin Core. Please let me know, then I'll delete it. – Murch Jan 8 at 18:17
  • Thank you for all response, I mean orphan block in bitcore. in bitcore repository issue, micahriggan replyed to the question(github.com/bitpay/bitcore/issues/2659) – SeungJun Jan 10 at 4:26
1

If there are multiple chaintips that match in total work, Bitcoin Core will consider the one it heard first about the best chain. Only if another chaintip accumulates more work, it'll switch to that chaintip. As only one block can be part of the best chain at the same height, the competing block is essentially irrelevant unless it happens to become part of the best chaintip.

Example:
After block 99, there were two competing blocks found at the same time. Our full node first hears about block 100A (the asterisk marks the block our full node currently considers the chaintip), and a peer announces chaintip B with a different block at height 100. Bitcoin Core will not update its chaintip, but still consider 100A the best chaintip.

           100A*
98 ← 99 ↢
           100B

It's very unlikely that both 100A and 100B get a successor block at the same time. Let's say that the chaintip B is extended first.

           100A*
98 ← 99 ↢
           100B ← 101B

Upon learning about the new best chain, our full node will first revert block 100A: all of the transactions that got confirmed in block 100A get added back to the mempool and marked unconfirmed.

            100A
98 ← 99* ↢
            100B ← 101B

Then the full node follows the best chain by applying the two blocks 100B and 101B.

           100A
98 ← 99 ↢
           100B ← 101B*

Any transactions that had been confirmed in 100A might have now been associated with 100B or 101B instead, or they may still be in the mempool.

| improve this answer | |

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.