diff --git a/substrate/client/chain-spec/src/chain_spec.rs b/substrate/client/chain-spec/src/chain_spec.rs index fa161f1202ab1..293bee612b262 100644 --- a/substrate/client/chain-spec/src/chain_spec.rs +++ b/substrate/client/chain-spec/src/chain_spec.rs @@ -314,6 +314,7 @@ pub struct ChainSpecBuilder { protocol_id: Option, fork_id: Option, properties: Option, + code_substitutes: Option>, } impl ChainSpecBuilder { @@ -331,6 +332,7 @@ impl ChainSpecBuilder { protocol_id: None, fork_id: None, properties: None, + code_substitutes: None, } } @@ -413,6 +415,12 @@ impl ChainSpecBuilder { self } + /// Sets the `code_substitutes`. + pub fn with_code_substitutes(mut self, code_substitutes: BTreeMap) -> Self { + self.code_substitutes = Some(code_substitutes); + self + } + /// Builds a [`ChainSpec`] instance using the provided settings. pub fn build(self) -> ChainSpec { let client_spec = ClientSpec { @@ -427,7 +435,7 @@ impl ChainSpecBuilder { extensions: self.extensions, consensus_engine: (), genesis: Default::default(), - code_substitutes: BTreeMap::new(), + code_substitutes: self.code_substitutes.unwrap_or_default(), }; ChainSpec {