예제 #1
0
        public void Is_fast_block_finished_returns_true_when_no_fast_block_sync_is_used()
        {
            IBlockTree      blockTree      = Substitute.For <IBlockTree>();
            IReceiptStorage receiptStorage = Substitute.For <IReceiptStorage>();
            IDb             stateDb        = new MemDb();
            SyncConfig      syncConfig     = new SyncConfig();

            syncConfig.FastBlocks  = false;
            syncConfig.PivotNumber = "1";

            SyncProgressResolver syncProgressResolver = new SyncProgressResolver(blockTree, receiptStorage, stateDb, new MemDb(), syncConfig, LimboLogs.Instance);

            Assert.True(syncProgressResolver.IsFastBlocksHeadersFinished());
            Assert.True(syncProgressResolver.IsFastBlocksBodiesFinished());
            Assert.True(syncProgressResolver.IsFastBlocksReceiptsFinished());
        }
예제 #2
0
        public void Is_fast_block_receipts_finished_returns_true_when_receipts_not_downloaded_and_we_do_not_want_to_download_receipts()
        {
            IBlockTree      blockTree      = Substitute.For <IBlockTree>();
            IReceiptStorage receiptStorage = Substitute.For <IReceiptStorage>();
            IDb             stateDb        = new MemDb();
            SyncConfig      syncConfig     = new SyncConfig();

            syncConfig.FastBlocks = true;
            syncConfig.DownloadBodiesInFastSync   = true;
            syncConfig.DownloadReceiptsInFastSync = false;
            syncConfig.PivotNumber = "1";

            blockTree.LowestInsertedHeader.Returns(Build.A.BlockHeader.WithNumber(1).WithStateRoot(TestItem.KeccakA).TestObject);
            blockTree.LowestInsertedBody.Returns(Build.A.Block.WithNumber(1).WithStateRoot(TestItem.KeccakA).TestObject);
            receiptStorage.LowestInsertedReceiptBlock.Returns(2);

            SyncProgressResolver syncProgressResolver = new SyncProgressResolver(blockTree, receiptStorage, stateDb, new MemDb(), syncConfig, LimboLogs.Instance);

            Assert.True(syncProgressResolver.IsFastBlocksReceiptsFinished());
        }