public void When_just_started_full_sync_with_fast_blocks(FastBlocksState fastBlocksState) { Scenario.GoesLikeThis(_needToWaitForHeaders) .IfThisNodeJustStartedFullSyncProcessing(fastBlocksState) .AndGoodPeersAreKnown() .WhenFastSyncWithFastBlocksIsConfigured() .TheSyncModeShouldBe(GetExpectationsIfNeedToWaitForHeaders(SyncMode.Full | fastBlocksState.GetSyncMode(true))); }
public void Just_after_finishing_state_sync_but_not_fast_blocks(FastBlocksState fastBlocksState) { Scenario.GoesLikeThis(_needToWaitForHeaders) .IfThisNodeFinishedStateSyncButNotFastBlocks(fastBlocksState) .WhenFastSyncWithFastBlocksIsConfigured() .AndGoodPeersAreKnown() .TheSyncModeShouldBe(GetExpectationsIfNeedToWaitForHeaders(SyncMode.Full | fastBlocksState.GetSyncMode(true))); }
public void When_peers_move_slightly_forward_when_state_syncing(FastBlocksState fastBlocksState) { Scenario.GoesLikeThis(_needToWaitForHeaders) .WhenInBeaconSyncMode(_mode) .IfThisNodeJustFinishedFastBlocksAndFastSync(fastBlocksState) .AndPeersMovedSlightlyForward() .WhenFastSyncWithFastBlocksIsConfigured() .TheSyncModeShouldBe(GetExpectationsIfNeedToWaitForHeaders(GetBeaconSyncExpectations(SyncMode.StateNodes | SyncMode.FastSync | fastBlocksState.GetSyncMode()))); }
public void Just_after_finishing_state_sync_and_fast_blocks(FastBlocksState fastBlocksState) { Scenario.GoesLikeThis(_needToWaitForHeaders) .WhenInBeaconSyncMode(_mode) .IfThisNodeJustFinishedStateSyncAndFastBlocks(fastBlocksState) .WhenFastSyncWithFastBlocksIsConfigured() .AndGoodPeersAreKnown() .TheSyncModeShouldBe(GetBeaconSyncExpectations(SyncMode.Full | fastBlocksState.GetSyncMode(true))); }
public static SyncMode GetSyncMode(this FastBlocksState state, bool isFullSync = false) { switch (state) { case FastBlocksState.None: return(SyncMode.FastHeaders); case FastBlocksState.FinishedHeaders: return(isFullSync ? SyncMode.FastBodies : SyncMode.None); case FastBlocksState.FinishedBodies: return(isFullSync ? SyncMode.FastReceipts : SyncMode.None); default: return(SyncMode.None); } }
public void Returns(FastBlocksState returns) { _syncProgressResolver.IsFastBlocksHeadersFinished().Returns(returns >= FastBlocksState.FinishedHeaders); _syncProgressResolver.IsFastBlocksBodiesFinished().Returns(returns >= FastBlocksState.FinishedBodies); _syncProgressResolver.IsFastBlocksReceiptsFinished().Returns(returns >= FastBlocksState.FinishedReceipts); }
public void Finished_fast_sync_but_not_state_sync_and_lesser_peers_are_known_in_fast_blocks(FastBlocksState fastBlocksState) { Scenario.GoesLikeThis(_needToWaitForHeaders) .IfThisNodeJustFinishedFastBlocksAndFastSync(fastBlocksState) .AndPeersAreOnlyUsefulForFastBlocks() .WhenFastSyncWithFastBlocksIsConfigured() .TheSyncModeShouldBe(fastBlocksState.GetSyncMode()); }