2

While working with log filters i've noticed interesting behavior of logs during chain reorganizations. Sometimes same event (log) can have different logIndex in transaction after chain reorganizations.

My question is: can logIndex change in the same block? For example: it happens that sometimes you can get duplicate events from listening eth_getFilterChanges, can it be that event you get as Duplicate (has same tx hash and blocknum) can have another logIndex than before?

Second question is: why do logIndex change at all?!

2

In a chain reorganization the order of the transaction can change, some transactions can be removed, and new ones added replacing others.

Since the log order follows the order of the transactions a chain reorganization can cause the logIndex to be different.

Moreover it is possible some events disappear from a block and appear again later if the transaction that generated the event was removed from a block.

The reverse also happens, a new event can appear if a new transaction was added to the block.

  • Thanks for your answer, but can logIndex change in same block while i'm listening for logChanges from geth? – Coder Jan 26 '18 at 10:11
  • And also how many blocks later can happen reorganization? – Coder Jan 26 '18 at 10:14
  • In a chain reorg a block can be replaced by another, so the transaction order can be different, and the logindex will change accordingly. A chain reorg has no limit on how many blocks it will affect. Most wallets use a 12 blocks as confirmation, meaning a chain reorg of more than 12 blocks is unlikely. – Ismael Jan 26 '18 at 14:31
  • Thanks for your reply, so there is no guarantee that there wont be any chain reorganizations even after 12 blocks? – Coder Jan 26 '18 at 14:34

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.