Trace New Block inclusion - Wiki OpenEthereum Documentation

Trace New Block inclusion

All numbering can be traced in code by searching // t_nb x.y This is very rough tracing of new block inclusion for example transaction execution in virtual machine is just one point while it doesn’t explain what is going on inside. Intention of this file is to make easier to find flow of of one feature in code. It covers stages from when block is received from network to when new block is executed, included and rebroadcasted to network.

1. Receive and decode stage

2. Importing block into queue for validation

3. Check if same block is already in queue

VerificationQueue::import: 3

4. Basic block verification done on import

Phase1 verification Kind::Create verify_block_basic

5. Verification on solo block.

Phase 2 verification. Perform costly checks such as transaction signatures and block nonce for ethash.

6. Verification on parent->child, execute transaction and commit.

7. Check and enact given block.

8. Block enacting. Execution of transactions.

For execution we create new OpenBlock, and execute tx while adding them to block)

9. Commit block to database

10. Notify miner about new included block.

if there are imported blocks and there are no new blocks in pipiline that needs to be included, notify miner.

  1. We ignore blocks that were imported unless resealing on new uncles is enabled.
  2. We ignore blocks that are invalid because it doesn’t have any meaning in terms of the transactions that are in those blocks

11. Notify rest of system about new block

This is done in not particular order. but for sake of numeration i will mark them with numbers.