make instantSeal engine backwards compatible, closes #9696 (#9700)

This commit is contained in:
Marek Kotewicz
2018-10-04 14:08:20 +01:00
committed by Andronik Ordian
parent c8ae675b95
commit 6b286a5dee
4 changed files with 20 additions and 5 deletions

View File

@@ -26,7 +26,7 @@ pub enum Engine {
Null(NullEngine),
/// Instantly sealing engine.
#[serde(rename="instantSeal")]
InstantSeal(InstantSeal),
InstantSeal(Option<InstantSeal>),
/// Ethash engine.
Ethash(Ethash),
/// BasicAuthority engine.
@@ -71,6 +71,17 @@ mod tests {
_ => panic!(),
};
let s = r#"{
"instantSeal": null
}"#;
let deserialized: Engine = serde_json::from_str(s).unwrap();
match deserialized {
Engine::InstantSeal(_) => {}, // instant seal is unit tested in its own file.
_ => panic!(),
};
let s = r#"{
"Ethash": {
"params": {