It comes to my curiousity about how exactly the node A will mine block N+1 when he & node B generated block N (not in same time but) in a fairly close timeframe.
In many articles, it says that when 2 nodes (A&B) are generating the same height block at same time, it will cause a fork. This means some nodes will mine after A's new block and others mine B's. This is understood. However, it will take time when A's new block sync to B. Let's assume it takes 10 seconds to pass to B. In the middle of the sync (saying 5th or 6th second of total 10), B just generates the new block (with same height), and propagate it out before receiving A's block. What will happen when B receives A's block then?
I have 2 possible answers but not sure which one is correct, or neither. (assuming all TX/UTXO in the block has no issue)
ANSWER-1: B will discard B's block, and accept A's, because B block's timestamp is older than A's (make sense?)
ANSWER-2: when B broadcasts his new block, B by default accepts its own generated block (N+1) and immediately start to mine block N+2 upon that (at the time when B has not received A's block yet.) Then B receives A's block (N+1), in this case, B should keep A's chain but still continue to mine at his N+2 block height.
Any advice?