Skip to content

Commit

Permalink
Don't create reward account if no reward (hyperledger#7826)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
matthew1001 authored Nov 20, 2024
1 parent 46f3d64 commit e85a436
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,10 @@ public TransactionProcessingResult processTransaction(
coinbaseCalculator.price(usedGas, transactionGasPrice, blockHeader.getBaseFee());

operationTracer.traceBeforeRewardTransaction(worldUpdater, transaction, coinbaseWeiDelta);

final var coinbase = evmWorldUpdater.getOrCreate(miningBeneficiary);
coinbase.incrementBalance(coinbaseWeiDelta);
if (!coinbaseWeiDelta.isZero() || !clearEmptyAccounts) {
final var coinbase = evmWorldUpdater.getOrCreate(miningBeneficiary);
coinbase.incrementBalance(coinbaseWeiDelta);
}

operationTracer.traceEndTransaction(
evmWorldUpdater.updater(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ void shouldWarmCoinbaseIfRequested() {
.thenReturn(ValidationResult.valid());
when(transactionValidatorFactory.get().validateForSender(any(), any(), any()))
.thenReturn(ValidationResult.valid());
when(worldState.getOrCreate(any())).thenReturn(senderAccount);
when(worldState.getOrCreateSenderAccount(any())).thenReturn(senderAccount);
when(worldState.updater()).thenReturn(worldState);

Expand Down

0 comments on commit e85a436

Please sign in to comment.