Temporary canonical multihash in peer ID. (#1449)

* Temporary canonical multihash in peer ID.

* Reduce code duplication.

* Remove unnecessary impls.

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
This commit is contained in:
Roman Borschel
2020-02-13 10:36:14 +01:00
committed by GitHub
parent 8238fd2100
commit b872bd9030
9 changed files with 77 additions and 63 deletions

View File

@ -578,7 +578,7 @@ impl Gossipsub {
"Handling subscriptions: {:?}, from source: {:?}",
subscriptions, propagation_source
);
let subscribed_topics = match self.peer_topics.get_mut(&propagation_source) {
let subscribed_topics = match self.peer_topics.get_mut(propagation_source) {
Some(topics) => topics,
None => {
error!("Subscription by unknown peer: {:?}", &propagation_source);
@ -841,7 +841,7 @@ impl Gossipsub {
})
.collect();
let mut prunes: Vec<GossipsubControlAction> = to_prune
.remove(&peer)
.remove(peer)
.unwrap_or_else(|| vec![])
.iter()
.map(|topic_hash| GossipsubControlAction::Prune {
@ -1028,7 +1028,7 @@ impl NetworkBehaviour for Gossipsub {
// remove from mesh, topic_peers, peer_topic and fanout
debug!("Peer disconnected: {:?}", id);
{
let topics = match self.peer_topics.get(&id) {
let topics = match self.peer_topics.get(id) {
Some(topics) => (topics),
None => {
warn!("Disconnected node, not in connected nodes");