public async Task ResetChainToLib_Test() { var chain = await _fullBlockchainService.GetChainAsync(); chain = await _fullBlockchainService.ResetChainToLibAsync(chain); chain.BestChainHash.ShouldBe(chain.LastIrreversibleBlockHash); chain.BestChainHeight.ShouldBe(chain.LastIrreversibleBlockHeight); chain.LongestChainHash.ShouldBe(chain.LastIrreversibleBlockHash); chain.LongestChainHeight.ShouldBe(chain.LastIrreversibleBlockHeight); chain.Branches.Count.ShouldBe(1); chain.Branches[chain.LastIrreversibleBlockHash.ToStorageKey()].ShouldBe(chain.LastIrreversibleBlockHeight); chain.NotLinkedBlocks.ShouldBeEmpty(); foreach (var block in _kernelTestHelper.LongestBranchBlockList) { var chainBlockLink = await _chainManager.GetChainBlockLinkAsync(block.GetHash()); chainBlockLink.IsLinked.ShouldBeFalse(); chainBlockLink.ExecutionStatus.ShouldBe(ChainBlockLinkExecutionStatus.ExecutionNone); } foreach (var block in _kernelTestHelper.ForkBranchBlockList) { var chainBlockLink = await _chainManager.GetChainBlockLinkAsync(block.GetHash()); chainBlockLink.IsLinked.ShouldBeFalse(); chainBlockLink.ExecutionStatus.ShouldBe(ChainBlockLinkExecutionStatus.ExecutionNone); } foreach (var block in _kernelTestHelper.ForkBranchBlockList.TakeWhile(block => block.Height != chain.LastIrreversibleBlockHeight)) { var chainBlockLink = await _chainManager.GetChainBlockLinkAsync(block.GetHash()); chainBlockLink.IsLinked.ShouldBeFalse(); chainBlockLink.ExecutionStatus.ShouldBe(ChainBlockLinkExecutionStatus.ExecutionNone); } }