Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c31d416
Added option to disable default block announce
cecton Feb 26, 2020
ba360ca
Added on_block_imported on NetworkService
cecton Feb 27, 2020
f52a4c9
Update from parent 'origin/master' (no conflict)
cecton Mar 12, 2020
61c5d4b
Update from parent 'origin/master' (conflicts)
cecton Mar 12, 2020
c1a3ede
Revert "Added on_block_imported on NetworkService"
cecton Mar 13, 2020
f76a080
Do not announce block if set to not announce block
cecton Mar 13, 2020
de2027b
Revert fix
cecton Mar 13, 2020
9137f9e
Moving default announce block to NetworkConfig
cecton Mar 13, 2020
7911167
WIP
cecton Mar 13, 2020
ee66173
WIP
cecton Mar 17, 2020
2f111f0
Removing boolean in favor of explicit call
cecton Mar 23, 2020
30d493f
Fixing tests
cecton Mar 23, 2020
be04bda
WIP
cecton Mar 27, 2020
8f63872
WIP
cecton Mar 27, 2020
6404281
increase spec_version
cecton Mar 27, 2020
779215f
Update from parent 'origin/master' (no conflict)
cecton Mar 27, 2020
66d038d
Update from parent 'origin/master' (conflicts)
cecton Mar 27, 2020
4a073a4
increase spec_version
cecton Mar 27, 2020
19ea9f9
Update from parent 'origin/master' (no conflict)
cecton Mar 27, 2020
875f4a3
Update from parent 'origin/master' (conflicts)
cecton Mar 27, 2020
7aa6ee8
Fixed test
cecton Mar 27, 2020
6a616d5
Fixing test
cecton Mar 30, 2020
54403aa
Update from parent 'origin/master' (no conflict)
cecton Mar 30, 2020
c61ac54
Renamed should_announce_imported_blocks to announce_imported_blocks
cecton Mar 30, 2020
96e6379
Updated assert_cmd
cecton Mar 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions client/network/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1446,6 +1446,11 @@ impl<B: BlockT, H: ExHashT> Protocol<B, H> {
return;
}

// blocks are announced by default
if !self.config.default_block_announce {
return;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomaka something like this?

// send out block announcements
self.send_announcement(header, data, is_best, false);
}
Expand Down
1 change: 1 addition & 0 deletions client/service/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,7 @@ ServiceBuilder<
network_status_sinks.clone(),
system_rpc_rx,
has_bootnodes,
config.default_announce_block,
),
);

Expand Down
3 changes: 3 additions & 0 deletions client/service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ pub struct Configuration<G, E = NoExtension> {
///
/// The default value is 8.
pub max_runtime_instances: usize,
/// Use default block announcement
pub default_announce_block: bool,
}

/// Configuration of the client keystore.
Expand Down Expand Up @@ -229,6 +231,7 @@ impl<G, E> Default for Configuration<G, E> {
tracing_targets: Default::default(),
tracing_receiver: Default::default(),
max_runtime_instances: 8,
default_announce_block: true,
}
}
}
Expand Down
9 changes: 6 additions & 3 deletions client/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,16 +326,19 @@ fn build_network_future<
status_sinks: Arc<Mutex<status_sinks::StatusSinks<(NetworkStatus<B>, NetworkState)>>>,
mut rpc_rx: mpsc::UnboundedReceiver<sc_rpc::system::Request<B>>,
should_have_peers: bool,
default_announce_block: bool,
) -> impl Future<Output = ()> {
let mut imported_blocks_stream = client.import_notification_stream().fuse();
let mut finality_notification_stream = client.finality_notification_stream().fuse();

futures::future::poll_fn(move |cx| {
let before_polling = Instant::now();

// We poll `imported_blocks_stream`.
while let Poll::Ready(Some(notification)) = Pin::new(&mut imported_blocks_stream).poll_next(cx) {
network.on_block_imported(notification.header, Vec::new(), notification.is_new_best);
if default_announce_block {
// We poll `imported_blocks_stream`.
while let Poll::Ready(Some(notification)) = Pin::new(&mut imported_blocks_stream).poll_next(cx) {
network.on_block_imported(notification.header, Vec::new(), notification.is_new_best);
}
}

// We poll `finality_notification_stream`, but we only take the last event.
Expand Down
1 change: 1 addition & 0 deletions client/service/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ fn node_config<G, E: Clone> (
tracing_targets: None,
tracing_receiver: Default::default(),
max_runtime_instances: 8,
default_announce_block: true,
}
}

Expand Down