Skip to content

Commit

Permalink
Fast sync state error (#3261)
Browse files Browse the repository at this point in the history
* Final commit to log and exit for fastSyncState.getPivotBlockHeader().get()

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
Signed-off-by: Swarnim Pratap Singh <swarnimpratap132@gmail.com>

Co-authored-by: Sally MacFarlane <sally.macfarlane@consensys.net>
Co-authored-by: Swarnim Pratap Singh <swarnim132@gmail.com>
  • Loading branch information
3 people authored Jan 19, 2022
1 parent 0ed8240 commit 100630b
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ public CompletableFuture<Void> run(
return failed;
}

Optional<BlockHeader> checkNull =
Optional.ofNullable(fastSyncState.getPivotBlockHeader().get());
if (checkNull.isEmpty()) {
LOG.error("Pivot Block not present");
final CompletableFuture<Void> failed = new CompletableFuture<>();
failed.completeExceptionally(new NullPointerException("Pivot Block not present"));
return failed;
}

final BlockHeader header = fastSyncState.getPivotBlockHeader().get();
final Hash stateRoot = header.getStateRoot();
if (worldStateStorage.isWorldStateAvailable(stateRoot, header.getHash())) {
Expand Down

0 comments on commit 100630b

Please sign in to comment.