Don't create reward account if no reward (#7826)

* Don't create reward account if no reward

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>

* Remove unnecessary test stub

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>

* Extra check to only create 0 balance accounts if clearEmptyAccounts isn't set

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>

---------

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>
pull/7800/merge
Matt Whitehead 1 week ago committed by GitHub
parent 46f3d649b6
commit e85a436032
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java
  2. 1
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessorTest.java

@ -532,9 +532,10 @@ public class MainnetTransactionProcessor {
coinbaseCalculator.price(usedGas, transactionGasPrice, blockHeader.getBaseFee()); coinbaseCalculator.price(usedGas, transactionGasPrice, blockHeader.getBaseFee());
operationTracer.traceBeforeRewardTransaction(worldUpdater, transaction, coinbaseWeiDelta); operationTracer.traceBeforeRewardTransaction(worldUpdater, transaction, coinbaseWeiDelta);
if (!coinbaseWeiDelta.isZero() || !clearEmptyAccounts) {
final var coinbase = evmWorldUpdater.getOrCreate(miningBeneficiary); final var coinbase = evmWorldUpdater.getOrCreate(miningBeneficiary);
coinbase.incrementBalance(coinbaseWeiDelta); coinbase.incrementBalance(coinbaseWeiDelta);
}
operationTracer.traceEndTransaction( operationTracer.traceEndTransaction(
evmWorldUpdater.updater(), evmWorldUpdater.updater(),

@ -108,7 +108,6 @@ class MainnetTransactionProcessorTest {
.thenReturn(ValidationResult.valid()); .thenReturn(ValidationResult.valid());
when(transactionValidatorFactory.get().validateForSender(any(), any(), any())) when(transactionValidatorFactory.get().validateForSender(any(), any(), any()))
.thenReturn(ValidationResult.valid()); .thenReturn(ValidationResult.valid());
when(worldState.getOrCreate(any())).thenReturn(senderAccount);
when(worldState.getOrCreateSenderAccount(any())).thenReturn(senderAccount); when(worldState.getOrCreateSenderAccount(any())).thenReturn(senderAccount);
when(worldState.updater()).thenReturn(worldState); when(worldState.updater()).thenReturn(worldState);

Loading…
Cancel
Save