darkfid::task::unknown_proposal

Function handle_reorg

Source
async fn handle_reorg(
    validator: ValidatorPtr,
    p2p: P2pPtr,
    proposals_sub: JsonSubscriber,
    blocks_sub: JsonSubscriber,
    channel: ChannelPtr,
    proposal: Proposal,
) -> Result<()>
Expand description

Auxiliary function to handle a potential reorg. We first find our last common block with the peer, then grab the header sequence from that block until the proposal and check if it ranks higher than our current best ranking fork, to perform a reorg.