Skip to content
Snippets Groups Projects
  • Davide Galassi's avatar
    Add stale branches heads to finality notifications (#10639) · 7f3bb8d0
    Davide Galassi authored
    
    * Add stale branches heads to finality notifications
    
    Warning. Previous implementation was sending a notification for
    each block between the previous (explicitly) finalized block and
    the new finalized one (with an hardcoded limit of 256).
    
    Now finality notification is sent only for the new finalized head and it
    contains the hash of the new finalized head, new finalized head header,
    a list of all the implicitly finalized blocks and a list of stale
    branches heads (i.e. the branches heads that are not part of the
    canonical chain anymore).
    
    * Add implicitly finalized blocks list to `ChainEvent::Finalized` message
    
    The list contains all the blocks between the previously finalized block
    up to the parent of the currently finalized one, sorted by block number.
    
    `Finalized` messages handler, part of the `MaintainedTransactionPool`
    implementation for `BasicPool`, still propagate full set of finalized
    blocks to the txpool by iterating over implicitly finalized blocks list.
    
    * Rust fmt
    
    * Greedy evaluation of `stale_heads` during finalization
    
    * Fix outdated assumption in a comment
    
    * Removed a test optimization that is no more relevant
    
    The loop was there to prevent sending to
    `peer.network.on_block_finalized` the full list of finalized blocks.
    
    Now only the finalized heads are received.
    
    * Last finalized block lookup not required anymore
    
    * Tests for block finality notifications payloads
    
    * Document a bit tricky condition to avoid duplicate finalization notifications
    
    * More idiomatic way to skip an iterator entry
    
    Co-authored-by: default avatarBastian Köcher <bkchr@users.noreply.github.com>
    
    * Cargo fmt iteration
    
    * Typo fix
    
    Co-authored-by: default avatarBastian Köcher <bkchr@users.noreply.github.com>
    
    * Fix potential failure when a finalized orphan block is imported
    
    * Apply suggestions from code review
    
    Co-authored-by: default avatarBastian Köcher <bkchr@users.noreply.github.com>
    
    * Apply suggestions from code review
    
    Co-authored-by: default avatarBastian Köcher <bkchr@users.noreply.github.com>
    
    Co-authored-by: default avatarBastian Köcher <bkchr@users.noreply.github.com>
    7f3bb8d0
Code owners
Assign users and groups as approvers for specific file changes. Learn more.