Only recheck blocks with non-fatal inherent transaction errors

This commit is contained in:
Luke Parker
2022-11-11 02:17:10 -05:00
parent 7d46daa36e
commit 6f74bade8b
2 changed files with 23 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
use std::{
sync::{Arc, RwLock},
time::{UNIX_EPOCH, SystemTime, Duration},
collections::HashSet,
};
use async_trait::async_trait;
@@ -318,8 +319,7 @@ impl<T: TendermintValidator> Network for TendermintAuthority<T> {
origin: None,
allow_missing_state: false,
skip_execution: false,
// TODO: Only set to true if block was rejected due to its inherents
import_existing: true,
import_existing: self.import.recheck.read().unwrap().contains(&hash),
state: None,
}],
);
@@ -354,6 +354,9 @@ impl<T: TendermintValidator> Network for TendermintAuthority<T> {
.map_err(|_| Error::InvalidJustification)
.unwrap();
// Clear any blocks for the previous height we were willing to recheck
*self.import.recheck.write().unwrap() = HashSet::new();
let number: u64 = match (*block.header().number()).try_into() {
Ok(number) => number,
Err(_) => panic!("BlockNumber exceeded u64"),