fix(pool): max init code error (#13564)

This commit is contained in:
Roman Krasiuk
2024-12-27 16:07:10 +01:00
committed by GitHub
parent 8f81f0ccf2
commit 4ef9537e0a
2 changed files with 4 additions and 6 deletions

View File

@ -196,7 +196,7 @@ pub enum InvalidPoolTransactionError {
ExceedsGasLimit(u64, u64),
/// Thrown when a new transaction is added to the pool, but then immediately discarded to
/// respect the `max_init_code_size`.
#[error("transaction's size {0} exceeds max_init_code_size {1}")]
#[error("transaction's input size {0} exceeds max_init_code_size {1}")]
ExceedsMaxInitCodeSize(usize, usize),
/// Thrown if the input data of a transaction is greater
/// than some meaningful limit a user might use. This is not a consensus error

View File

@ -1133,11 +1133,9 @@ pub trait PoolTransaction:
&self,
max_init_code_size: usize,
) -> Result<(), InvalidPoolTransactionError> {
if self.is_create() && self.input().len() > max_init_code_size {
Err(InvalidPoolTransactionError::ExceedsMaxInitCodeSize(
self.size(),
max_init_code_size,
))
let input_len = self.input().len();
if self.is_create() && input_len > max_init_code_size {
Err(InvalidPoolTransactionError::ExceedsMaxInitCodeSize(input_len, max_init_code_size))
} else {
Ok(())
}