use of org.hyperledger.besu.ethereum.mainnet.MainnetTransactionValidator in project besu by hyperledger.
the class GoQuorumBlockProcessor method validateTransaction.
private ValidationResult<TransactionInvalidReason> validateTransaction(final BlockHeader blockHeader, final Transaction transaction, final WorldUpdater publicWorldStateUpdater) {
final MainnetTransactionValidator transactionValidator = transactionProcessor.getTransactionValidator();
final TransactionValidationParams transactionValidationParams = TransactionValidationParams.processingBlock();
ValidationResult<TransactionInvalidReason> validationResult = transactionValidator.validate(transaction, blockHeader.getBaseFee(), transactionValidationParams);
if (!validationResult.isValid()) {
LOG.warn("Invalid transaction: {}. Block {} Transaction {}", validationResult.getErrorMessage(), blockHeader.getHash().toHexString(), transaction.getHash().toHexString());
return validationResult;
}
final Address senderAddress = transaction.getSender();
final EvmAccount sender = publicWorldStateUpdater.getOrCreate(senderAddress);
validationResult = transactionValidator.validateForSender(transaction, sender, transactionValidationParams);
if (!validationResult.isValid()) {
LOG.warn("Invalid transaction: {}. Block {} Transaction {}", validationResult.getErrorMessage(), blockHeader.getHash().toHexString(), transaction.getHash().toHexString());
return validationResult;
}
return ValidationResult.valid();
}
use of org.hyperledger.besu.ethereum.mainnet.MainnetTransactionValidator in project besu by hyperledger.
the class BlockTransactionSelector method validateTransaction.
private ValidationResult<TransactionInvalidReason> validateTransaction(final ProcessableBlockHeader blockHeader, final Transaction transaction, final WorldUpdater publicWorldStateUpdater) {
final TransactionValidationParams transactionValidationParams = TransactionValidationParams.processingBlock();
final MainnetTransactionValidator transactionValidator = transactionProcessor.getTransactionValidator();
ValidationResult<TransactionInvalidReason> validationResult = transactionValidator.validate(transaction, blockHeader.getBaseFee(), transactionValidationParams);
if (!validationResult.isValid()) {
return validationResult;
}
final Address senderAddress = transaction.getSender();
final EvmAccount sender = publicWorldStateUpdater.getOrCreate(senderAddress);
validationResult = transactionValidator.validateForSender(transaction, sender, transactionValidationParams);
return validationResult;
}
Aggregations