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()); }
public void Is_fast_block_headers_finished_returns_false_when_headers_not_downloaded() { 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 = true; syncConfig.PivotNumber = "1"; blockTree.LowestInsertedHeader.Returns(Build.A.BlockHeader.WithNumber(2).WithStateRoot(TestItem.KeccakA).TestObject); SyncProgressResolver syncProgressResolver = new SyncProgressResolver(blockTree, receiptStorage, stateDb, new MemDb(), syncConfig, LimboLogs.Instance); Assert.False(syncProgressResolver.IsFastBlocksHeadersFinished()); }