feat(rpc) : support for eth_newPendingTransactionFilter full rpc function (#5206)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
DoTheBestToGetTheBest
2023-10-30 11:00:30 -07:00
committed by GitHub
parent 64d50643c8
commit ed9b9a7d82
6 changed files with 184 additions and 25 deletions

View File

@ -1113,6 +1113,22 @@ impl<Tx: PoolTransaction> NewSubpoolTransactionStream<Tx> {
pub fn new(st: Receiver<NewTransactionEvent<Tx>>, subpool: SubPool) -> Self {
Self { st, subpool }
}
/// Tries to receive the next value for this stream.
pub fn try_recv(
&mut self,
) -> Result<NewTransactionEvent<Tx>, tokio::sync::mpsc::error::TryRecvError> {
loop {
match self.st.try_recv() {
Ok(event) => {
if event.subpool == self.subpool {
return Ok(event)
}
}
Err(e) => return Err(e),
}
}
}
}
impl<Tx: PoolTransaction> Stream for NewSubpoolTransactionStream<Tx> {