mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix(net): outgoing requsts (#398)
* remove inpossible case * fix(net): outgoing requests stopping
This commit is contained in:
@ -532,10 +532,9 @@ where
|
||||
?error,
|
||||
"Outgoing pending session failed"
|
||||
);
|
||||
this.swarm
|
||||
.state_mut()
|
||||
.peers_mut()
|
||||
.apply_reputation_change(&peer_id, ReputationChangeKind::FailedToConnect);
|
||||
let swarm = this.swarm.state_mut().peers_mut();
|
||||
swarm.on_closed_outgoing_pending_session();
|
||||
swarm.apply_reputation_change(&peer_id, ReputationChangeKind::FailedToConnect);
|
||||
}
|
||||
SwarmEvent::OutgoingConnectionError { remote_addr, peer_id, error } => {
|
||||
warn!(
|
||||
|
||||
@ -121,6 +121,10 @@ impl PeersManager {
|
||||
pub(crate) fn on_closed_incoming_pending_session(&mut self) {
|
||||
self.connection_info.decr_in()
|
||||
}
|
||||
/// Invoked when a pending session was closed.
|
||||
pub(crate) fn on_closed_outgoing_pending_session(&mut self) {
|
||||
self.connection_info.decr_out()
|
||||
}
|
||||
|
||||
/// Called when a new _incoming_ active session was established to the given peer.
|
||||
///
|
||||
|
||||
@ -194,7 +194,7 @@ where
|
||||
) -> PoolResult<TxHash> {
|
||||
match tx {
|
||||
TransactionValidationOutcome::Valid { balance, state_nonce, transaction } => {
|
||||
let sender_id = self.get_sender_id(*transaction.sender());
|
||||
let sender_id = self.get_sender_id(transaction.sender());
|
||||
let transaction_id = TransactionId::new(sender_id, transaction.nonce());
|
||||
|
||||
let tx = ValidPoolTransaction {
|
||||
|
||||
@ -238,7 +238,7 @@ impl<T: TransactionOrdering> TxPool<T> {
|
||||
Err(PoolError::ProtocolFeeCapTooLow(*transaction.hash(), fee_cap))
|
||||
}
|
||||
Err(InsertErr::ExceededSenderTransactionsCapacity { transaction }) => {
|
||||
Err(PoolError::SpammerExceededCapacity(*transaction.sender(), *transaction.hash()))
|
||||
Err(PoolError::SpammerExceededCapacity(transaction.sender(), *transaction.hash()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -282,10 +282,10 @@ impl PoolTransaction for MockTransaction {
|
||||
}
|
||||
}
|
||||
|
||||
fn sender(&self) -> &Address {
|
||||
fn sender(&self) -> Address {
|
||||
match self {
|
||||
MockTransaction::Legacy { sender, .. } => sender,
|
||||
MockTransaction::Eip1559 { sender, .. } => sender,
|
||||
MockTransaction::Legacy { sender, .. } => *sender,
|
||||
MockTransaction::Eip1559 { sender, .. } => *sender,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -240,7 +240,7 @@ pub trait PoolTransaction: fmt::Debug + Send + Sync + FromRecoveredTransaction {
|
||||
fn hash(&self) -> &TxHash;
|
||||
|
||||
/// The Sender of the transaction.
|
||||
fn sender(&self) -> &Address;
|
||||
fn sender(&self) -> Address;
|
||||
|
||||
/// Returns the nonce for this transaction.
|
||||
fn nonce(&self) -> u64;
|
||||
|
||||
@ -69,7 +69,7 @@ impl<T: PoolTransaction> ValidPoolTransaction<T> {
|
||||
}
|
||||
|
||||
/// Returns the address of the sender
|
||||
pub fn sender(&self) -> &Address {
|
||||
pub fn sender(&self) -> Address {
|
||||
self.transaction.sender()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user