Make `NetworkService` callable for `ChainSync` (#12542)
Introduce a middleware called `NetworkServiceProvider` which the `ChainSync` can use to communicate with `NetworkService`. `ChainSync` is given a `NetworkServiceHandle` which it uses to call `NetworkServiceProvider` which then dispatches the calls to `NetworkService` on behalf of `ChainSync`. This change will allow `ChainSync` to disconnect and report peers and in the future it'll be possible to send requests and notifications through the `NetworkServiceProvider`. `NetworkServiceProvider` is needed only until the `ChainSync` object has been removed from `Protocol`. After that, a normal `NetworkService` handle can be passed onto `ChainSync` and these changes can be deprecated. Co-authored-by: parity-processbot <>
Showing
- substrate/client/network/src/service/tests/chain_sync.rs 179 additions, 3 deletionssubstrate/client/network/src/service/tests/chain_sync.rs
- substrate/client/network/src/service/tests/mod.rs 27 additions, 1 deletionsubstrate/client/network/src/service/tests/mod.rs
- substrate/client/network/sync/src/lib.rs 38 additions, 3 deletionssubstrate/client/network/sync/src/lib.rs
- substrate/client/network/sync/src/service/mock.rs 46 additions, 2 deletionssubstrate/client/network/sync/src/service/mock.rs
- substrate/client/network/sync/src/service/mod.rs 1 addition, 0 deletionssubstrate/client/network/sync/src/service/mod.rs
- substrate/client/network/sync/src/service/network.rs 128 additions, 0 deletionssubstrate/client/network/sync/src/service/network.rs
- substrate/client/network/sync/src/tests.rs 3 additions, 1 deletionsubstrate/client/network/sync/src/tests.rs
- substrate/client/network/test/src/lib.rs 10 additions, 2 deletionssubstrate/client/network/test/src/lib.rs
- substrate/client/service/src/builder.rs 11 additions, 1 deletionsubstrate/client/service/src/builder.rs
Please register or sign in to comment