0

I refer to the transaction flow in the following link:

https://web3j.readthedocs.io/en/latest/_images/web3j_transaction.png

What happens if the transaction is propagated to other ethereum client (not miners yet) and these clients are already processing the transaction but when the miner process it, this transaction is invalid and not included in the block.

What happens to the other ethereum clients which have first processed the transaction before the miner got hold of it? What happen to their state?

1

Your chain of events is slightly incorrect.

When a node receives a tx, they don't immediately apply its effects to their state. They hold it in the txpool, and forward to other nodes.

State changes are only applied when the tx is mined into a block, and that new block is received by the node.

If a tx is valid at the time of broadcast, but something causes it to be invalid when mined, it will still be part of the block. However, since blocks are processed in order, and transactions within blocks are also processed in order, the same invalid result of the tx will occur on all nodes, and they will revert any changes caused by it.

A common example of this is A transferring all of their tokens to B, and also making another tx transferring all of their tokens to C. Both txs are valid, until they are mined into blocks. After that, only the first tx in order of appearance is valid, and the second one fails (but is still included in the block, and still consumes gas for the calculations upto the point it fails at).

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.