mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: use broadcast tx generic (#12733)
This commit is contained in:
@ -182,7 +182,11 @@ pub enum EthMessage<N: NetworkPrimitives = EthNetworkPrimitives> {
|
||||
)]
|
||||
NewBlock(Box<NewBlock<N::Block>>),
|
||||
/// Represents a Transactions message broadcast to the network.
|
||||
Transactions(Transactions),
|
||||
#[cfg_attr(
|
||||
feature = "serde",
|
||||
serde(bound = "N::BroadcastedTransaction: serde::Serialize + serde::de::DeserializeOwned")
|
||||
)]
|
||||
Transactions(Transactions<N::BroadcastedTransaction>),
|
||||
/// Represents a `NewPooledTransactionHashes` message for eth/66 version.
|
||||
NewPooledTransactionHashes66(NewPooledTransactionHashes66),
|
||||
/// Represents a `NewPooledTransactionHashes` message for eth/68 version.
|
||||
@ -302,7 +306,7 @@ pub enum EthBroadcastMessage<N: NetworkPrimitives = EthNetworkPrimitives> {
|
||||
/// Represents a new block broadcast message.
|
||||
NewBlock(Arc<NewBlock<N::Block>>),
|
||||
/// Represents a transactions broadcast message.
|
||||
Transactions(SharedTransactions),
|
||||
Transactions(SharedTransactions<N::BroadcastedTransaction>),
|
||||
}
|
||||
|
||||
// === impl EthBroadcastMessage ===
|
||||
|
||||
@ -48,9 +48,9 @@ pub enum PeerMessage<N: NetworkPrimitives = EthNetworkPrimitives> {
|
||||
/// Broadcast new block.
|
||||
NewBlock(NewBlockMessage<N::Block>),
|
||||
/// Received transactions _from_ the peer
|
||||
ReceivedTransaction(Transactions),
|
||||
ReceivedTransaction(Transactions<N::BroadcastedTransaction>),
|
||||
/// Broadcast transactions _from_ local _to_ a peer.
|
||||
SendTransactions(SharedTransactions),
|
||||
SendTransactions(SharedTransactions<N::BroadcastedTransaction>),
|
||||
/// Send new pooled transactions
|
||||
PooledTransactions(NewPooledTransactionHashes),
|
||||
/// All `eth` request variants.
|
||||
|
||||
@ -21,7 +21,6 @@ use reth_network_api::{
|
||||
use reth_network_p2p::sync::{NetworkSyncUpdater, SyncState, SyncStateProvider};
|
||||
use reth_network_peers::{NodeRecord, PeerId};
|
||||
use reth_network_types::{PeerAddr, PeerKind, Reputation, ReputationChangeKind};
|
||||
use reth_primitives::TransactionSigned;
|
||||
use reth_tokio_util::{EventSender, EventStream};
|
||||
use secp256k1::SecretKey;
|
||||
use std::{
|
||||
@ -130,7 +129,7 @@ impl<N: NetworkPrimitives> NetworkHandle<N> {
|
||||
}
|
||||
|
||||
/// Send full transactions to the peer
|
||||
pub fn send_transactions(&self, peer_id: PeerId, msg: Vec<Arc<TransactionSigned>>) {
|
||||
pub fn send_transactions(&self, peer_id: PeerId, msg: Vec<Arc<N::BroadcastedTransaction>>) {
|
||||
self.send_message(NetworkHandleMessage::SendTransaction {
|
||||
peer_id,
|
||||
msg: SharedTransactions(msg),
|
||||
@ -466,7 +465,7 @@ pub(crate) enum NetworkHandleMessage<N: NetworkPrimitives = EthNetworkPrimitives
|
||||
/// The ID of the peer to which the transactions are sent.
|
||||
peer_id: PeerId,
|
||||
/// The shared transactions to send.
|
||||
msg: SharedTransactions,
|
||||
msg: SharedTransactions<N::BroadcastedTransaction>,
|
||||
},
|
||||
/// Sends a list of transaction hashes to the given peer.
|
||||
SendPooledTransactionHashes {
|
||||
|
||||
@ -1768,7 +1768,7 @@ pub enum NetworkTransactionEvent<N: NetworkPrimitives = EthNetworkPrimitives> {
|
||||
/// The ID of the peer from which the transactions were received.
|
||||
peer_id: PeerId,
|
||||
/// The received transactions.
|
||||
msg: Transactions,
|
||||
msg: Transactions<N::BroadcastedTransaction>,
|
||||
},
|
||||
/// Represents the event of receiving a list of transaction hashes from a peer.
|
||||
IncomingPooledTransactionHashes {
|
||||
|
||||
Reference in New Issue
Block a user