Fix invalid root (#3005)

* use the correct (header) head for the header extension

* add test coverage for header first fork scenario
This commit is contained in:
Antioch Peverell
2019-08-29 10:15:41 +01:00
committed by GitHub
parent dcd405e263
commit 357bc11746
2 changed files with 85 additions and 33 deletions
+4 -3
View File
@@ -550,9 +550,10 @@ where
let res: Result<T, Error>;
let rollback: bool;
// We want to use the current head of the most work chain unless
// we explicitly rewind the extension.
let head = batch.head()?;
// We want to use the current head of header chain here.
// Caller is responsible for rewinding the header MMR back
// to a previous header as necessary when processing a fork.
let head = batch.header_head()?;
// create a child transaction so if the state is rolled back by itself, all
// index saving can be undone