Change to optional orElseGet (#4993)

Fix do not evaluate second expression if the value is present.

Signed-off-by: ħþ <12281088+helderjnpinto@users.noreply.github.com>

Signed-off-by: ħþ <12281088+helderjnpinto@users.noreply.github.com>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
pull/5001/head
ħþ 2 years ago committed by GitHub
parent ab4208018e
commit 03581022a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/TransactionCompleteResult.java

@ -95,7 +95,9 @@ public class TransactionCompleteResult implements TransactionResult {
tx.getTransaction().getMaxFeePerGas().map(Wei::toShortHexString).orElse(null);
this.gasPrice =
Quantity.create(
transaction.getGasPrice().orElse(transaction.getEffectiveGasPrice(tx.getBaseFee())));
transaction
.getGasPrice()
.orElseGet(() -> transaction.getEffectiveGasPrice(tx.getBaseFee())));
this.hash = transaction.getHash().toString();
this.input = transaction.getPayload().toString();
this.nonce = Quantity.create(transaction.getNonce());

Loading…
Cancel
Save