Skip to content

Commit

Permalink
Use orElseGet for efficiency, address comment of previous PR 8139
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel-Trintinalia <[email protected]>
  • Loading branch information
Gabriel-Trintinalia committed Jan 21, 2025
1 parent 5933a2a commit 99dce46
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,11 @@ public Optional<TransactionSimulatorResult> processWithWorldUpdater(
final long nonce =
callParams
.getNonce()
.orElse(
Optional.ofNullable(updater.get(senderAddress)).map(Account::getNonce).orElse(0L));
.orElseGet(
() ->
Optional.ofNullable(updater.get(senderAddress))
.map(Account::getNonce)
.orElse(0L));

final long simulationGasCap =
calculateSimulationGasCap(callParams.getGasLimit(), blockHeaderToProcess.getGasLimit());
Expand Down

0 comments on commit 99dce46

Please sign in to comment.