Default fork choice value and intermediates for block import parameters (#4652)

* consensus, pow: intermediate separation and fail

* Fix compiles

* Update primitives/consensus/common/src/block_import.rs

Co-Authored-By: Robert Habermeier <rphmeier@gmail.com>

* Update primitives/consensus/common/src/block_import.rs

Co-Authored-By: Robert Habermeier <rphmeier@gmail.com>

* Document what None means for `fork_choice` in block import params

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
This commit is contained in:
Wei Tang
2020-01-23 00:03:38 -08:00
committed by GitHub
parent 9a77b299df
commit 4b2e6a5be2
13 changed files with 289 additions and 149 deletions
+16 -8
View File
@@ -96,7 +96,8 @@ impl<Block: BlockT, T, Transaction> ClientBlockImportExt<Block> for std::sync::A
storage_changes: None,
finalized: false,
auxiliary: Vec::new(),
fork_choice: ForkChoiceStrategy::LongestChain,
intermediates: Default::default(),
fork_choice: Some(ForkChoiceStrategy::LongestChain),
allow_missing_state: false,
import_existing: false,
};
@@ -115,7 +116,8 @@ impl<Block: BlockT, T, Transaction> ClientBlockImportExt<Block> for std::sync::A
storage_changes: None,
finalized: false,
auxiliary: Vec::new(),
fork_choice: ForkChoiceStrategy::Custom(true),
intermediates: Default::default(),
fork_choice: Some(ForkChoiceStrategy::Custom(true)),
allow_missing_state: false,
import_existing: false,
};
@@ -134,7 +136,8 @@ impl<Block: BlockT, T, Transaction> ClientBlockImportExt<Block> for std::sync::A
storage_changes: None,
finalized: true,
auxiliary: Vec::new(),
fork_choice: ForkChoiceStrategy::Custom(true),
intermediates: Default::default(),
fork_choice: Some(ForkChoiceStrategy::Custom(true)),
allow_missing_state: false,
import_existing: false,
};
@@ -158,7 +161,8 @@ impl<Block: BlockT, T, Transaction> ClientBlockImportExt<Block> for std::sync::A
storage_changes: None,
finalized: true,
auxiliary: Vec::new(),
fork_choice: ForkChoiceStrategy::LongestChain,
intermediates: Default::default(),
fork_choice: Some(ForkChoiceStrategy::LongestChain),
allow_missing_state: false,
import_existing: false,
};
@@ -182,7 +186,8 @@ impl<B, E, RA, Block: BlockT> ClientBlockImportExt<Block> for Client<B, E, Block
storage_changes: None,
finalized: false,
auxiliary: Vec::new(),
fork_choice: ForkChoiceStrategy::LongestChain,
intermediates: Default::default(),
fork_choice: Some(ForkChoiceStrategy::LongestChain),
allow_missing_state: false,
import_existing: false,
};
@@ -201,7 +206,8 @@ impl<B, E, RA, Block: BlockT> ClientBlockImportExt<Block> for Client<B, E, Block
storage_changes: None,
finalized: false,
auxiliary: Vec::new(),
fork_choice: ForkChoiceStrategy::Custom(true),
intermediates: Default::default(),
fork_choice: Some(ForkChoiceStrategy::Custom(true)),
allow_missing_state: false,
import_existing: false,
};
@@ -220,7 +226,8 @@ impl<B, E, RA, Block: BlockT> ClientBlockImportExt<Block> for Client<B, E, Block
storage_changes: None,
finalized: true,
auxiliary: Vec::new(),
fork_choice: ForkChoiceStrategy::Custom(true),
intermediates: Default::default(),
fork_choice: Some(ForkChoiceStrategy::Custom(true)),
allow_missing_state: false,
import_existing: false,
};
@@ -244,7 +251,8 @@ impl<B, E, RA, Block: BlockT> ClientBlockImportExt<Block> for Client<B, E, Block
storage_changes: None,
finalized: true,
auxiliary: Vec::new(),
fork_choice: ForkChoiceStrategy::LongestChain,
intermediates: Default::default(),
fork_choice: Some(ForkChoiceStrategy::LongestChain),
allow_missing_state: false,
import_existing: false,
};