示例#1
0
        public void Can_keep_changing_in_fast_sync()
        {
            IEthSyncPeerPool syncPeerPool = Substitute.For <IEthSyncPeerPool>();
            ISyncPeer        syncPeer     = Substitute.For <ISyncPeer>();

            syncPeer.TotalDifficultyOnSessionStart.Returns((UInt256)(1024 * 1024));

            PeerInfo peerInfo1 = new PeerInfo(syncPeer)
            {
                HeadNumber = 0, IsInitialized = true
            };

            syncPeerPool.AllPeers.Returns(new[] { peerInfo1 });
            syncPeerPool.UsefulPeers.Returns(new[] { peerInfo1 });
            syncPeerPool.PeerCount.Returns(1);

            SyncConfig syncConfig = new SyncConfig();

            syncConfig.FastSync    = true;
            syncConfig.PivotNumber = null;
            syncConfig.PivotHash   = null;

            ISyncProgressResolver syncProgressResolver = Substitute.For <ISyncProgressResolver>();

            SyncModeSelector selector = new SyncModeSelector(syncProgressResolver, syncPeerPool, syncConfig, LimboLogs.Instance);

            Assert.AreEqual(SyncMode.NotStarted, selector.Current);

            (long BestRemote, long BestLocalHeader, long BestLocalFullBlock, long BestLocalState, SyncMode ExpectedState, string Description)[] states =
示例#2
0
        public void Starts_with_not_started()
        {
            SyncModeSelector selector = BuildSelector(new SyncConfig()
            {
                FastSync = false
            });

            Assert.AreEqual(SyncMode.NotStarted, selector.Current);
        }
示例#3
0
        public void Starts_with_not_started()
        {
            SyncModeSelector selector = BuildSelector(false);

            Assert.AreEqual(SyncMode.NotStarted, selector.Current);
        }
示例#4
0
        public void Starts_with_not_started_in_fast_sync_enabled()
        {
            SyncModeSelector selector = BuildSelector(true);

            Assert.AreEqual(SyncMode.NotStarted, selector.Current);
        }
示例#5
0
        public void Starts_with_full_when_fast_sync_is_disabled()
        {
            SyncModeSelector selector = BuildSelector(false);

            Assert.AreEqual(SyncMode.Full, selector.Current);
        }
示例#6
0
        public void Starts_with_headers_when_fast_sync_is_enabled()
        {
            SyncModeSelector selector = BuildSelector(true);

            Assert.AreEqual(SyncMode.Headers, selector.Current);
        }