chore: replace TransactionSigned struct inits with new functions (#12779)

This commit is contained in:
Tien Nguyen
2024-11-22 21:28:59 +07:00
committed by GitHub
parent 64728e0856
commit f2860006f7
8 changed files with 63 additions and 81 deletions

View File

@ -407,7 +407,7 @@ impl<Provider, Pool, Network, EvmConfig> EthApiInner<Provider, Pool, Network, Ev
mod tests {
use alloy_consensus::Header;
use alloy_eips::BlockNumberOrTag;
use alloy_primitives::{B256, U64};
use alloy_primitives::{PrimitiveSignature as Signature, B256, U64};
use alloy_rpc_types::FeeHistory;
use jsonrpsee_types::error::INVALID_PARAMS_CODE;
use reth_chainspec::{BaseFeeParams, ChainSpec, EthChainSpec};
@ -504,23 +504,21 @@ mod tests {
let random_fee: u128 = rng.gen();
if let Some(base_fee_per_gas) = header.base_fee_per_gas {
let transaction = TransactionSigned {
transaction: reth_primitives::Transaction::Eip1559(
alloy_consensus::TxEip1559 {
max_priority_fee_per_gas: random_fee,
max_fee_per_gas: random_fee + base_fee_per_gas as u128,
..Default::default()
},
),
..Default::default()
};
let transaction = TransactionSigned::new_unhashed(
reth_primitives::Transaction::Eip1559(alloy_consensus::TxEip1559 {
max_priority_fee_per_gas: random_fee,
max_fee_per_gas: random_fee + base_fee_per_gas as u128,
..Default::default()
}),
Signature::test_signature(),
);
transactions.push(transaction);
} else {
let transaction = TransactionSigned {
transaction: reth_primitives::Transaction::Legacy(Default::default()),
..Default::default()
};
let transaction = TransactionSigned::new_unhashed(
reth_primitives::Transaction::Legacy(Default::default()),
Signature::test_signature(),
);
transactions.push(transaction);
}