client/network-gossip/state_machine: Reduce indentation level (#5714)

* client/network-gossip/src/state_machine: Add unit test for on_incoming

Add two unit tests to ensure `on_incoming` is ingoring discarded
messages and reports and ignores messages from unknown peers.

* client/network-gossip/state_machine: Reduce indentation level

* client/network-gossip/bridge: Remove unnecessary into_iter

* client/network-gossip/state_machine: Report success after register check

* client/network-gossip/state_machine: Error not report on unregistered

`peers` contains all the peers we're connected to. If we receive a
message from a peer not in this list, that means there's an internal
problem within the local client. It's not the fault of the peer in
question.

With the above in mind instead of reducing the reputation of such peer,
log an error.
This commit is contained in:
Max Inden
2020-04-23 09:58:43 +02:00
committed by GitHub
parent 421ef498f4
commit e84b06a8c0
2 changed files with 119 additions and 67 deletions
@@ -182,7 +182,7 @@ impl<B: BlockT> Future for GossipEngine<B> {
messages,
);
for (topic, notification) in to_forward.into_iter() {
for (topic, notification) in to_forward {
if let Entry::Occupied(mut entry) = this.message_sinks.entry(topic) {
trace!(
target: "gossip",