Skip to content

Commit

Permalink
roll the "fix invalid root" changes into this PR
Browse files Browse the repository at this point in the history
  • Loading branch information
antiochp committed Aug 29, 2019
1 parent 9bdef10 commit 4436cb6
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions chain/src/txhashset/txhashset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,15 +300,14 @@ where
let commit_index = trees.commit_index.clone();
let batch = commit_index.batch()?;

// We want to use the current head of the most work chain unless
// we explicitly rewind the extension.
let head = batch.head()?;

trace!("Starting new txhashset (readonly) extension.");

let head = batch.head()?;
let header_head = batch.header_head()?;

let res = {
let header_pmmr = PMMR::at(&mut handle.backend, handle.last_pos);
let mut header_extension = HeaderExtension::new(header_pmmr, &batch, head.clone());
let mut header_extension = HeaderExtension::new(header_pmmr, &batch, header_head);
let mut extension = Extension::new(trees, &batch, head);
let mut extension_pair = ExtensionPair {
header_extension: &mut header_extension,
Expand Down Expand Up @@ -399,9 +398,8 @@ 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()?;
let header_head = batch.header_head()?;

// create a child transaction so if the state is rolled back by itself, all
// index saving can be undone
Expand All @@ -410,7 +408,7 @@ where
trace!("Starting new txhashset extension.");

let pmmr = PMMR::at(&mut header_pmmr.backend, header_pmmr.last_pos);
let mut header_extension = HeaderExtension::new(pmmr, &child_batch, head.clone());
let mut header_extension = HeaderExtension::new(pmmr, &child_batch, header_head);
let mut extension = Extension::new(trees, &child_batch, head);
let mut extension_pair = ExtensionPair {
header_extension: &mut header_extension,
Expand Down

0 comments on commit 4436cb6

Please sign in to comment.