public void Setup()
        {
            _localReceiptStorage          = new InMemoryReceiptStorage();
            _syncPeers                    = new List <LatencySyncPeerMock>();
            _peerTrees                    = new Dictionary <LatencySyncPeerMock, IBlockTree>();
            _peerMaxResponseSizes         = new Dictionary <LatencySyncPeerMock, int>();
            _pendingResponses             = new Dictionary <LatencySyncPeerMock, FastBlocksBatch>();
            _invalidBlocks                = new Dictionary <LatencySyncPeerMock, HashSet <long> >();
            _maliciousByRepetition        = new HashSet <LatencySyncPeerMock>();
            _maliciousByInvalidTxs        = new HashSet <LatencySyncPeerMock>();
            _maliciousByInvalidOmmers     = new HashSet <LatencySyncPeerMock>();
            _maliciousByShiftedOneForward = new HashSet <LatencySyncPeerMock>();
            _maliciousByShiftedOneBack    = new HashSet <LatencySyncPeerMock>();
            _maliciousByShortAtStart      = new HashSet <LatencySyncPeerMock>();
            _maliciousByInvalidReceipts   = new HashSet <LatencySyncPeerMock>();
            _incorrectByTooShortMessages  = new HashSet <LatencySyncPeerMock>();
            _incorrectByTooLongMessages   = new HashSet <LatencySyncPeerMock>();
            _timingOut                    = new HashSet <LatencySyncPeerMock>();
            _scheduledActions             = new Dictionary <long, Action>();

            LatencySyncPeerMock.RemoteIndex = 1;
            _time         = 0;
            _syncPeerPool = Substitute.For <IEthSyncPeerPool>();
            _syncPeerPool.WhenForAnyArgs(p => p.ReportNoSyncProgress(Arg.Any <SyncPeerAllocation>()))
            .Do(ci =>
            {
                LatencySyncPeerMock mock = ((LatencySyncPeerMock)ci.Arg <SyncPeerAllocation>().Current.SyncPeer);
                mock.BusyUntil           = _time + 5000;
                mock.IsReported          = true;
            });

            _syncPeerPool.WhenForAnyArgs(p => p.ReportNoSyncProgress(Arg.Any <PeerInfo>()))
            .Do(ci =>
            {
                LatencySyncPeerMock mock = ((LatencySyncPeerMock)ci.Arg <PeerInfo>().SyncPeer);
                mock.BusyUntil           = _time + 5000;
                mock.IsReported          = true;
            });

            _syncPeerPool.WhenForAnyArgs(p => p.ReportInvalid(Arg.Any <SyncPeerAllocation>()))
            .Do(ci =>
            {
                LatencySyncPeerMock mock = ((LatencySyncPeerMock)ci.Arg <SyncPeerAllocation>().Current.SyncPeer);
                mock.BusyUntil           = _time + 30000;
                mock.IsReported          = true;
            });

            _syncPeerPool.WhenForAnyArgs(p => p.ReportInvalid(Arg.Any <PeerInfo>()))
            .Do(ci =>
            {
                LatencySyncPeerMock mock = ((LatencySyncPeerMock)ci.Arg <PeerInfo>().SyncPeer);
                mock.BusyUntil           = _time + 30000;
                mock.IsReported          = true;
            });

            _syncPeerPool.AllPeers.Returns((ci) => _syncPeers.Select(sp => new PeerInfo(sp)
            {
                HeadNumber = sp.Tree.Head.Number
            }));

            _syncConfig                      = new SyncConfig();
            _syncConfig.PivotHash            = _validTree2048.Head.Hash.ToString();
            _syncConfig.PivotNumber          = _validTree2048.Head.Number.ToString();
            _syncConfig.PivotTotalDifficulty = _validTree2048.Head.TotalDifficulty.ToString();

            SetupLocalTree();
            SetupFeed();
        }