Fix PR 4098 (#4106)

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
pull/4107/head
Fabio Di Fabio 2 years ago committed by GitHub
parent 2c26259348
commit 94e6541ca1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardChain.java

@ -95,22 +95,6 @@ public class BackwardChain {
return;
}
BlockHeader firstHeader = firstStoredAncestor.get();
if (firstHeader.getNumber() != blockHeader.getNumber() + 1) {
throw new BackwardSyncException(
"Wrong height of header "
+ blockHeader.getHash().toHexString()
+ " is "
+ blockHeader.getNumber()
+ " when we were expecting "
+ (firstHeader.getNumber() - 1));
}
if (!firstHeader.getParentHash().equals(blockHeader.getHash())) {
throw new BackwardSyncException(
"Hash of header does not match our expectations, was "
+ blockHeader.toLogString()
+ " when we expected "
+ firstHeader.getParentHash().toHexString());
}
headers.put(blockHeader.getHash(), blockHeader);
chainStorage.put(blockHeader.getHash(), firstStoredAncestor.get().getHash());
firstStoredAncestor = Optional.of(blockHeader);

Loading…
Cancel
Save