wrap sender account in SimpleAccount to prevent holding references to Snapshot transactions in memory (#4605)

Signed-off-by: garyschulte <garyschulte@gmail.com>

Signed-off-by: garyschulte <garyschulte@gmail.com>
pull/4620/head
garyschulte 2 years ago committed by GitHub
parent ae6c88527a
commit e22a56378a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPool.java

@ -43,6 +43,7 @@ import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket;
import org.hyperledger.besu.ethereum.transaction.TransactionInvalidReason;
import org.hyperledger.besu.ethereum.trie.MerkleTrieException;
import org.hyperledger.besu.evm.account.Account;
import org.hyperledger.besu.evm.fluent.SimpleAccount;
import org.hyperledger.besu.metrics.BesuMetricCategory;
import org.hyperledger.besu.plugin.data.TransactionType;
import org.hyperledger.besu.plugin.services.MetricsSystem;
@ -380,7 +381,10 @@ public class TransactionPool implements BlockAddedObserver {
ValidationResultAndAccount(
final Account account, final ValidationResult<TransactionInvalidReason> result) {
this.result = result;
this.maybeAccount = Optional.ofNullable(account);
this.maybeAccount =
Optional.ofNullable(account)
.map(
acct -> new SimpleAccount(acct.getAddress(), acct.getNonce(), acct.getBalance()));
}
ValidationResultAndAccount(final ValidationResult<TransactionInvalidReason> result) {

Loading…
Cancel
Save