Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

improve ocw validator/collator CLI description #12931

Merged
merged 3 commits into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 2 deletions client/cli/src/arg_enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,9 @@ pub enum OffchainWorkerEnabled {
Always,
/// Never enable the offchain worker.
Never,
/// Only enable the offchain worker when running as validator.
WhenValidating,
/// Only enable the offchain worker when running as a validator (or collator, if this is a
/// parachain node).
WhenAuthority,
}

/// Syncing mode.
Expand Down
6 changes: 3 additions & 3 deletions client/cli/src/params/offchain_worker_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub struct OffchainWorkerParams {
value_name = "ENABLED",
value_enum,
ignore_case = true,
default_value_t = OffchainWorkerEnabled::WhenValidating
default_value_t = OffchainWorkerEnabled::WhenAuthority
)]
pub enabled: OffchainWorkerEnabled,

Expand All @@ -56,10 +56,10 @@ impl OffchainWorkerParams {
/// Load spec to `Configuration` from `OffchainWorkerParams` and spec factory.
pub fn offchain_worker(&self, role: &Role) -> error::Result<OffchainWorkerConfig> {
let enabled = match (&self.enabled, role) {
(OffchainWorkerEnabled::WhenValidating, Role::Authority { .. }) => true,
(OffchainWorkerEnabled::WhenAuthority, Role::Authority { .. }) => true,
(OffchainWorkerEnabled::Always, _) => true,
(OffchainWorkerEnabled::Never, _) => false,
(OffchainWorkerEnabled::WhenValidating, _) => false,
(OffchainWorkerEnabled::WhenAuthority, _) => false,
};

let indexing_enabled = self.indexing_enabled;
Expand Down