Skip to content

Commit 87a0174

Browse files
shemnonjflo
authored andcommitted
Improve BLOCKHASH Short Circuit (hyperledger#8171)
* Improve BLOCKHASH Short Circuit Signed-off-by: Danno Ferrin <[email protected]> Co-authored-by: Justin Florentine <[email protected]> Signed-off-by: Bhanu Pulluri <[email protected]>
1 parent 1f9a60b commit 87a0174

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

evm/src/main/java/org/hyperledger/besu/evm/operation/BlockHashOperation.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ public OperationResult execute(final MessageFrame frame, final EVM evm) {
5757
final long currentBlockNumber = blockValues.getNumber();
5858
final BlockHashLookup blockHashLookup = frame.getBlockHashLookup();
5959

60-
// If the current block is the genesis block or the sought block is
61-
// not within the lookback window, zero is returned.
62-
if (currentBlockNumber == 0
60+
// If the sought block is negative, a future block, the current block, or not in the
61+
// lookback window, zero is returned.
62+
if (soughtBlock < 0
6363
|| soughtBlock >= currentBlockNumber
6464
|| soughtBlock < (currentBlockNumber - blockHashLookup.getLookback())) {
6565
frame.pushStackItem(Bytes32.ZERO);

0 commit comments

Comments
 (0)