• Bastian Köcher's avatar
    Do not send empty view updates to peers (#2233) · 23f6d27f
    Bastian Köcher authored
    
    
    * Do not send empty view updates to peers
    
    It happened that we send empty view updates to our peers, because we
    only updated our finalized block. This could lead to situations where we
    overwhelmed sub systems with too many messages. On Rococo this lead to
    constant restarts of our nodes, because some node apparently was
    finalizing a lot of blocks.
    
    To prevent this, the pr is doing the following:
    
    1. If a peer sends us an empty view, we report this peer and decrease it
    reputation.
    
    2. We ensure that we only send a view update when the `heads` changed
    and not only the `finalized_number`.
    
    3. We do not send empty `ActiveLeavesUpdates` from the overseer, as this
    makes no sense to send these empty updates. If some subsystem is relying
    on the finalized block, it needs to listen for the overseer signal.
    
    * Update node/network/bridge/src/lib.rs
    
    Co-authored-by: default avatarPeter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
    
    * Don't work if they're are no added heads
    
    * Fix test
    
    * Ahhh
    
    * More fixes
    
    Co-authored-by: default avatarPeter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
    23f6d27f