Skip to content

Commit

Permalink
fixup! approval-distribution: Update topology if authorities are disc…
Browse files Browse the repository at this point in the history
…overed later (#2981)

The previous fix was actually incomplete because we update the
authorties only on the situation where we decided to reconnect because
we had a low connectivity issue. Now the problem is that
update_authority_ids use the list of connected peers, so on restart that
does contain anything, so calling immediately after
issue_connection_request won't detect all authorties, so we need to also
check every block as the comment said, but that did not match the code.
  • Loading branch information
alexggh committed Feb 8, 2024
1 parent 9e6298e commit 5f694a4
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions polkadot/node/network/gossip-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,30 @@ where
)
.await?;
}
// authority_discovery is just a cache so let's try every leaf to detect if there
// are new authorities there.
// authority_discovery is just a cache so let's try every time we try to re-connect
// if new authorities are present.
self.update_authority_ids(sender, session_info.discovery_keys).await;
} else if let Some(session_index) = self
.last_session_index
.filter(|last_session_index| *last_session_index >= current_index)
{
// authority_discovery is just a cache so let's try every leaf from the current
// session if there are new authorities detected and inform the needed subsystems.
let session_info =
util::request_session_info(leaf, session_index, sender).await.await??;

let session_info = match session_info {
Some(s) => s,
None => {
gum::warn!(
relay_parent = ?leaf,
session_index = self.last_session_index,
"Failed to get session info.",
);

continue
},
};
self.update_authority_ids(sender, session_info.discovery_keys).await;
}
}
Expand Down

0 comments on commit 5f694a4

Please sign in to comment.