Skip to content

Commit

Permalink
Check for state
Browse files Browse the repository at this point in the history
  • Loading branch information
asdacap committed Dec 31, 2024
1 parent cbac315 commit 262fdd8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public async Task Test_admin_dataDir()
public async Task Test_admin_verifyTrie()
{
(await RpcTest.TestSerializedRequest(_adminRpcModule, "admin_verifyTrie", "latest")).Should().Contain("Unable to start verify trie");
_stateReader.HasStateForRoot(Arg.Any<Hash256>()).Returns(true);
_blockingVerifyTrie.TryStartVerifyTrie(Arg.Any<BlockHeader>()).Returns(true);
(await RpcTest.TestSerializedRequest(_adminRpcModule, "admin_verifyTrie", "latest")).Should().Contain("Starting");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ public ResultWrapper<string> admin_verifyTrie(BlockParameter block)
return ResultWrapper<string>.Fail("Unable to find block. Unable to know state root to verify.");
}

if (!_stateReader.HasStateForBlock(header))
{
return ResultWrapper<string>.Fail("Unable to start verify trie. State for block missing.");
}

if (!_blockingVerifyTrie.TryStartVerifyTrie(header))
{
return ResultWrapper<string>.Fail("Unable to start verify trie. Verify trie already running.");
Expand Down

0 comments on commit 262fdd8

Please sign in to comment.