-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
this adds sequencer forwarding if the transaction was received via eth_sendrawtransaction
- Loading branch information
Showing
6 changed files
with
39 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//! P2P transaction forwarding | ||
use alloy_eips::eip2718::Decodable2718; | ||
use alloy_primitives::Bytes; | ||
use reth_network::{transactions::TransactionsHandle, NetworkPrimitives}; | ||
use reth_primitives_traits::transaction::signed::SignedTransaction; | ||
use tokio::sync::broadcast::Receiver; | ||
use tracing::trace; | ||
|
||
/// Forwards raw transactions to the network. | ||
pub async fn forward_raw_transactions<N: NetworkPrimitives>( | ||
txn: TransactionsHandle<N>, | ||
mut raw_txs: Receiver<Bytes>, | ||
) { | ||
loop { | ||
if let Ok(raw_tx) = raw_txs.recv().await { | ||
if let Ok(tx) = N::BroadcastedTransaction::decode_2718(&mut raw_tx.as_ref()) { | ||
trace!(target: "rpc::rpc", tx=%tx.tx_hash(), "Forwarding raw transaction over p2p"); | ||
txn.broadcast_transactions(Some(tx)); | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -18,5 +18,6 @@ | |
pub mod broadcaster; | ||
pub mod chainspec; | ||
pub mod evm; | ||
pub mod forwarder; | ||
pub mod node; | ||
pub mod rpc; |
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