-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* re-activate txpool API * clean up * clean up * clean up * clean up * clean up
- Loading branch information
Showing
10 changed files
with
296 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,16 @@ | ||
use crate::providers::eth_provider::provider::{EthApiResult, EthDataProvider}; | ||
use crate::providers::eth_provider::provider::EthApiResult; | ||
use async_trait::async_trait; | ||
use auto_impl::auto_impl; | ||
use mongodb::bson::doc; | ||
use reth_rpc_types::{txpool::TxpoolContent, Transaction}; | ||
use reth_rpc_types::txpool::TxpoolContent; | ||
|
||
/// Ethereum provider trait. Used to abstract away the database and the network. | ||
#[async_trait] | ||
#[auto_impl(Arc, &)] | ||
pub trait TxPoolProvider { | ||
/// Returns a vec of pending pool transactions. | ||
async fn txpool_transactions(&self) -> EthApiResult<Vec<Transaction>>; | ||
fn content(&self) -> TxpoolContent; | ||
|
||
/// Returns the content of the pending pool. | ||
async fn txpool_content(&self) -> EthApiResult<TxpoolContent>; | ||
} | ||
|
||
#[async_trait] | ||
impl<SP> TxPoolProvider for EthDataProvider<SP> | ||
where | ||
SP: starknet::providers::Provider + Send + Sync, | ||
{ | ||
async fn txpool_transactions(&self) -> EthApiResult<Vec<Transaction>> { | ||
// let span = tracing::span!(tracing::Level::INFO, "sn::txpool"); | ||
// TODO: we need certainly to move this implementation and rely on the mempool to check this | ||
Ok(vec![]) | ||
} | ||
|
||
async fn txpool_content(&self) -> EthApiResult<TxpoolContent> { | ||
Ok(self.txpool_transactions().await?.into_iter().fold(TxpoolContent::default(), |mut content, pending| { | ||
content.pending.entry(pending.from).or_default().insert(pending.nonce.to_string(), pending); | ||
content | ||
})) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.