mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
rpc: add missing fields in send_transaction (#1976)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
committed by
GitHub
parent
7c6c0b41e8
commit
481f60acee
@ -96,7 +96,7 @@ use crate::{
|
||||
pool::PoolInner,
|
||||
traits::{NewTransactionEvent, PoolSize},
|
||||
};
|
||||
use reth_primitives::{TxHash, U256};
|
||||
use reth_primitives::{Address, TxHash, U256};
|
||||
use reth_provider::StateProviderFactory;
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
use tokio::sync::mpsc::Receiver;
|
||||
@ -325,6 +325,18 @@ where
|
||||
fn on_propagated(&self, txs: PropagatedTransactions) {
|
||||
self.inner().on_propagated(txs)
|
||||
}
|
||||
|
||||
fn get_transactions_by_sender(
|
||||
&self,
|
||||
sender: Address,
|
||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>> {
|
||||
self.pool
|
||||
.pooled_transactions()
|
||||
.iter()
|
||||
.filter(|tx| tx.transaction.sender().eq(&sender))
|
||||
.map(Arc::clone)
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
impl<V: TransactionValidator, T: TransactionOrdering> Clone for Pool<V, T> {
|
||||
|
||||
@ -374,6 +374,18 @@ where
|
||||
self.pool.read().get(tx_hash)
|
||||
}
|
||||
|
||||
/// Returns all transactions of the address
|
||||
pub(crate) fn get_transactions_by_sender(
|
||||
&self,
|
||||
sender: Address,
|
||||
) -> Vec<Arc<ValidPoolTransaction<T::Transaction>>> {
|
||||
self.pooled_transactions()
|
||||
.iter()
|
||||
.filter(|tx| tx.transaction.sender().eq(&sender))
|
||||
.map(Arc::clone)
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Returns all the transactions belonging to the hashes.
|
||||
///
|
||||
/// If no transaction exists, it is skipped.
|
||||
|
||||
@ -145,6 +145,12 @@ pub trait TransactionPool: Send + Sync + Clone {
|
||||
///
|
||||
/// Consumer: P2P
|
||||
fn on_propagated(&self, txs: PropagatedTransactions);
|
||||
|
||||
/// Returns all transactions sent by a given user
|
||||
fn get_transactions_by_sender(
|
||||
&self,
|
||||
sender: Address,
|
||||
) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>;
|
||||
}
|
||||
|
||||
/// Represents a transaction that was propagated over the network.
|
||||
|
||||
Reference in New Issue
Block a user