Set uncles inherent (#3317)

* Include uncles

* Filter missing uncles

* Moved inherent registration to a new crate

* Ignore invalid inherent encoding
This commit is contained in:
Arkadiy Paronyan
2019-08-08 00:56:29 +02:00
committed by GitHub
parent ea58b7c92a
commit 58bd0d4c05
12 changed files with 319 additions and 82 deletions
+9 -8
View File
@@ -244,15 +244,16 @@ impl<T: Trait> ProvideInherent for Module<T> {
const INHERENT_IDENTIFIER: InherentIdentifier = INHERENT_IDENTIFIER;
fn create_inherent(data: &InherentData) -> Option<Self::Call> {
let final_num =
data.finalized_number().expect("Gets and decodes final number inherent data");
// make hint only when not same as last to avoid bloat.
Self::recent_hints().last().and_then(|last| if last == &final_num {
None
if let Ok(final_num) = data.finalized_number() {
// make hint only when not same as last to avoid bloat.
Self::recent_hints().last().and_then(|last| if last == &final_num {
None
} else {
Some(Call::final_hint(final_num))
})
} else {
Some(Call::final_hint(final_num))
})
None
}
}
fn check_inherent(_call: &Self::Call, _data: &InherentData) -> result::Result<(), Self::Error> {