1

I have this geth node that run in testnet and a program(worker) that will read the block every second. I notice sometimes, the geth imported segment chain with same block number but different hash, txs and other data.

If happen that the worker reads the block number(4926211) at first attempt, go through the transactions, and proceed to read the next attempt (repeat block 4926211), will it miss the other transactions? or will it effect the transactions that happen in that block?

enter image description here

  • I think you are describing a fork! You have two alternative versions of the last blocks. Eventually only one of the blocks will become part of the canonical history. – Briomkez Feb 1 at 7:47
  • Hi @Briomkez. Thank you for your answer. However, how do we know which version will be choose? I notice that the first version got 2 txs and second got 3 txs inside it. if it happen that first version became the part of canonical history, then what about the extra 1 txs that mentioned in second version? – amal Feb 2 at 8:29
0

You are describing a fork. You have two alternative versions of the last block(s). Eventually only one of them will become part of the canonical history.

To simplify the discussion I consider only the case with a fork of length 1, i.e. when we have two alternative version of the latest block (potentially, the fork(s) can be much longer).

Let's take a simple example (suggested in your comment). Let's say I have two alternative version of a block, whose number is x (4926211, in your case). Moreover, assume that in version A you have a sequence of transaction T_A (e.g., t_1, t_2, t_3) and in block B, you have another sequence of transaction T_B (e.g., t_2, t_4).

If A becomes part of the canonical history, in block x you will have only T_A (t_1, t_2, t_3). On the other case, if B becomes part of the history, block x will contain only T_B (t_2, t_4).

Basically, you have two possible "universes" in the former scenario the transaction of T_A will be confirmed and removed from the set of transaction-pool (t_1, t_2, t_3), while the transaction that belongs to T_B and not to T_A will be put in the transaction pool and considered for later insertion. In our example, only t_4.

  • Hi @Briomkez. Thank you for your explanation. I have better understanding bout how this work now.. :D – amal Feb 11 at 7:10
  • I am glad to read it! Can you considering accepting the answer/or upvoting it? – Briomkez Feb 11 at 9:01

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.