Add --only-mandatory-headers mode (#1004)

This commit is contained in:
Svyatoslav Nikolsky
2021-06-16 22:03:03 +03:00
committed by Bastian Köcher
parent 09df16612b
commit c69c682a4c
6 changed files with 260 additions and 58 deletions
@@ -24,6 +24,9 @@ pub struct RelayHeaders {
/// A bridge instance to relay headers for.
#[structopt(possible_values = &RelayHeadersBridge::variants(), case_insensitive = true)]
bridge: RelayHeadersBridge,
/// If passed, only mandatory headers (headers that are changing the GRANDPA authorities set) are relayed.
#[structopt(long)]
only_mandatory_headers: bool,
#[structopt(flatten)]
source: SourceConnectionParams,
#[structopt(flatten)]
@@ -100,7 +103,14 @@ impl RelayHeaders {
let finality = Finality::new(target_client.clone(), target_sign);
finality.start_relay_guards();
crate::finality_pipeline::run(finality, source_client, target_client, metrics_params).await
crate::finality_pipeline::run(
finality,
source_client,
target_client,
self.only_mandatory_headers,
metrics_params,
)
.await
})
}
}