client/network-gossip: Move sink IO outside of state_machine (#5669)

* client/network-gossip: Move sink IO outside of state_machine

`ConsensusGossip` is supposed to be a deterministic state machine.
`GossipEngine` wrapping `ConsensusGossip` should handle IO operations.

This commit moves the `message_sink` IO operations to `GossipEngine`.
More specifically on incoming messages a `GossipEngine` calls
`ConsensusGossip::on_incoming` to validate and register the messages.
`ConsensusGossip` returns the valid messages which are then forwarded by
`GossipEngine` to the upper layer via the `message_sinks`.

* client/network-gossip: Adjust and extend tests

* Update client/network-gossip/src/bridge.rs

Co-authored-by: Benjamin Kampmann <ben.kampmann@googlemail.com>
This commit is contained in:
Max Inden
2020-04-20 22:40:44 +02:00
committed by GitHub
parent 52d0173ec3
commit 5db336c743
4 changed files with 196 additions and 96 deletions
+1
View File
@@ -6463,6 +6463,7 @@ dependencies = [
name = "sc-network-gossip"
version = "0.8.0-dev"
dependencies = [
"async-std",
"futures 0.3.4",
"futures-timer 3.0.2",
"libp2p",