mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: append tx conditional to pooled tx (#14403)
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -8635,6 +8635,7 @@ dependencies = [
|
||||
"reth-optimism-forks",
|
||||
"reth-optimism-payload-builder",
|
||||
"reth-optimism-primitives",
|
||||
"reth-optimism-txpool",
|
||||
"reth-primitives",
|
||||
"reth-primitives-traits",
|
||||
"reth-provider",
|
||||
|
||||
@ -35,6 +35,7 @@ reth-optimism-chainspec.workspace = true
|
||||
reth-optimism-consensus.workspace = true
|
||||
reth-optimism-evm.workspace = true
|
||||
reth-optimism-payload-builder.workspace = true
|
||||
reth-optimism-txpool.workspace = true
|
||||
# TODO remove node-builder import
|
||||
reth-optimism-primitives = { workspace = true, features = ["reth-codec", "serde-bincode-compat"] }
|
||||
reth-optimism-forks.workspace = true
|
||||
@ -79,6 +80,7 @@ optimism = [
|
||||
"reth-optimism-consensus/optimism",
|
||||
"reth-optimism-payload-builder/optimism",
|
||||
"reth-optimism-primitives/optimism",
|
||||
"reth-optimism-txpool/optimism",
|
||||
]
|
||||
client = [
|
||||
"jsonrpsee/client",
|
||||
|
||||
@ -5,6 +5,7 @@ use alloy_eips::BlockNumberOrTag;
|
||||
use alloy_primitives::{Bytes, B256};
|
||||
use alloy_rpc_types_eth::erc4337::TransactionConditional;
|
||||
use jsonrpsee_core::RpcResult;
|
||||
use reth_optimism_txpool::conditional::MaybeConditionalTransaction;
|
||||
use reth_provider::{BlockReaderIdExt, StateProviderFactory};
|
||||
use reth_rpc_eth_api::L2EthApiExtServer;
|
||||
use reth_rpc_eth_types::utils::recover_raw_transaction;
|
||||
@ -49,7 +50,7 @@ impl<N> L2EthApiExtServer for OpEthApiExt<N>
|
||||
where
|
||||
N: OpNodeCore + 'static,
|
||||
N::Provider: BlockReaderIdExt + StateProviderFactory,
|
||||
N::Pool: TransactionPool,
|
||||
N::Pool: TransactionPool<Transaction: MaybeConditionalTransaction>,
|
||||
{
|
||||
async fn send_raw_transaction_conditional(
|
||||
&self,
|
||||
@ -66,7 +67,7 @@ where
|
||||
OpEthApiError::Eth(reth_rpc_eth_types::EthApiError::FailedToDecodeSignedTransaction)
|
||||
})?;
|
||||
|
||||
let tx = <N::Pool as TransactionPool>::Transaction::from_pooled(recovered_tx);
|
||||
let mut tx = <N::Pool as TransactionPool>::Transaction::from_pooled(recovered_tx);
|
||||
|
||||
// get current header
|
||||
let header_not_found = || {
|
||||
@ -97,8 +98,8 @@ where
|
||||
.map_err(OpEthApiError::Sequencer)?;
|
||||
Ok(*tx.hash())
|
||||
} else {
|
||||
// otherwise, add to pool
|
||||
// TODO: include conditional
|
||||
// otherwise, add to pool with the appended conditional
|
||||
tx.set_conditional(condition);
|
||||
let hash = self.pool().add_transaction(TransactionOrigin::External, tx).await.map_err(
|
||||
|e| OpEthApiError::Eth(reth_rpc_eth_types::EthApiError::PoolError(e.into())),
|
||||
)?;
|
||||
|
||||
Reference in New Issue
Block a user