Don't log errors on resubscription of gossip topics (#2613)
## Issue Addressed Resolves #2555 ## Proposed Changes Don't log errors on resubscribing to topics. Also don't log errors if we are setting already set attnet/syncnet bits.
This commit is contained in:
parent
58870fc6d3
commit
73ec29c267
@ -348,6 +348,8 @@ impl<TSpec: EthSpec> Behaviour<TSpec> {
|
||||
}
|
||||
|
||||
/// Subscribes to a gossipsub topic.
|
||||
///
|
||||
/// Returns `true` if the subscription was successful and `false` otherwise.
|
||||
pub fn subscribe(&mut self, topic: GossipTopic) -> bool {
|
||||
// update the network globals
|
||||
self.network_globals
|
||||
@ -358,13 +360,13 @@ impl<TSpec: EthSpec> Behaviour<TSpec> {
|
||||
let topic: Topic = topic.into();
|
||||
|
||||
match self.gossipsub.subscribe(&topic) {
|
||||
Err(_) => {
|
||||
warn!(self.log, "Failed to subscribe to topic"; "topic" => %topic);
|
||||
Err(e) => {
|
||||
warn!(self.log, "Failed to subscribe to topic"; "topic" => %topic, "error" => ?e);
|
||||
false
|
||||
}
|
||||
Ok(v) => {
|
||||
Ok(_) => {
|
||||
debug!(self.log, "Subscribed to topic"; "topic" => %topic);
|
||||
v
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -444,15 +444,13 @@ impl<TSpec: EthSpec> Discovery<TSpec> {
|
||||
));
|
||||
}
|
||||
|
||||
// The bitfield is already set to required value
|
||||
if current_bitfield
|
||||
.get(id)
|
||||
.map_err(|_| String::from("Subnet ID out of bounds"))?
|
||||
== value
|
||||
{
|
||||
return Err(format!(
|
||||
"Subnet id: {} already in the local ENR already has value: {}",
|
||||
id, value
|
||||
));
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// set the subnet bitfield in the ENR
|
||||
@ -480,15 +478,13 @@ impl<TSpec: EthSpec> Discovery<TSpec> {
|
||||
));
|
||||
}
|
||||
|
||||
// The bitfield is already set to required value
|
||||
if current_bitfield
|
||||
.get(id)
|
||||
.map_err(|_| String::from("Subnet ID out of bounds"))?
|
||||
== value
|
||||
{
|
||||
return Err(format!(
|
||||
"Subnet id: {} already in the local ENR already has value: {}",
|
||||
id, value
|
||||
));
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// set the subnet bitfield in the ENR
|
||||
|
Loading…
Reference in New Issue
Block a user