async fn check_chain_split<B: BlockchainBackend + 'static>(
    shared: &mut BaseNodeStateMachine<B>,
    sync_peers: &mut SyncPeers,
    local_tip_height: u64,
    network_tip_height: u64,
    local_block_hash: &[u8],
    network_block_hash: &[u8],
) -> Result<bool, BlockSyncError>
{
    match network_tip_height {
        tip if tip > local_tip_height => {
            let (header, _) = request_header(shared, sync_peers, local_tip_height).await?;
            Ok(header.hash() != local_block_hash)
        },
        tip if tip == local_tip_height => Ok(local_block_hash != network_block_hash),
        _ => Ok(true),
    }
}
// Perform a basic check to determine if a chain split has occurred between the local and network chain. The
// determine_sync_mode from the listening state would have ensured that when we reach this code that the network tip has
// a higher accumulated difficulty compared to the local chain. In the case when the network height is lower, but has a
// higher accumulated difficulty, then a network split must have occurred as the local chain will have a different block
// at the shared height if the local tip has a lower accumulated difficulty compared to the network tip.
Perform a basic check to determine if a chain split has occurred between the local and network chain. The
determine_sync_mode from the listening state would have ensured that when we reach this code that the network tip has
a higher accumulated difficulty compared to the local chain. In the case when the network height is lower, but has a
higher accumulated difficulty, then a network split must have occurred as the local chain will have a different block
at the shared height if the local tip has a lower accumulated difficulty compared to the network tip.
Perform a basic check to determine if a chain split has occurred between the local and network chain . The determine_sync_mode from the listening state would have ensured that when we reach this code that the network tip has a higher accumulated difficulty compared to the local chain . In the case when the network height is lower but has a higher accumulated difficulty then a network split must have occurred as the local chain will have a different block at the shared height if the local tip has a lower accumulated difficulty compared to the network tip .
async fn check_chain_split<B: BlockchainBackend + 'static>(
    shared: &mut BaseNodeStateMachine<B>,
    sync_peers: &mut SyncPeers,
    local_tip_height: u64,
    network_tip_height: u64,
    local_block_hash: &[u8],
    network_block_hash: &[u8],
) -> Result<bool, BlockSyncError>
{
    match network_tip_height {
        tip if tip > local_tip_height => {
            let (header, _) = request_header(shared, sync_peers, local_tip_height).await?;
            Ok(header.hash() != local_block_hash)
        },
        tip if tip == local_tip_height => Ok(local_block_hash != network_block_hash),
        _ => Ok(true),
    }
}
async fn check_chain_split < B : BlockchainBackend + ' static > ( shared : & mut BaseNodeStateMachine < B > , sync_peers : & mut SyncPeers , local_tip_height : u64 , network_tip_height : u64 , local_block_hash : & [ u8 ] , network_block_hash : & [ u8 ] , ) -> Result < bool , BlockSyncError > { match network_tip_height { tip if tip > local_tip_height => { let ( header , _ ) = request_header ( shared , sync_peers , local_tip_height ) . await ? ; Ok ( header . hash ( ) != local_block_hash ) } , tip if tip == local_tip_height => Ok ( local_block_hash != network_block_hash ) , _ => Ok ( true ) , } }
Perform a basic check to determine if a chain split has occurred between the local and network chain.
Perform a basic check to determine if a chain split has occurred between the local and network chain .
shared
&mut BaseNodeStateMachine<B>
sync_peers
&mut SyncPeers
local_tip_height
u64
network_tip_height
u64
local_block_hash
&[u8]
network_block_hash
&[u8]
shared
&mut BaseNodeStateMachine<B>
sync_peers
&mut SyncPeers
local_tip_height
u64
network_tip_height
u64
local_block_hash
&[u8]
network_block_hash
&[u8]