log some more fork related info when rewinding and applying a fork (#884)

This commit is contained in:
Antioch Peverell 2018-03-27 11:11:21 -04:00 committed by GitHub
parent 90c71625aa
commit 5bd0c251dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -515,7 +515,7 @@ pub fn rewind_and_apply_fork(
if let Ok(_) = store.is_on_current_chain(&curr_header) { if let Ok(_) = store.is_on_current_chain(&curr_header) {
break; break;
} else { } else {
hashes.insert(0, curr_header.hash()); hashes.insert(0, (curr_header.height, curr_header.hash()));
current = curr_header.previous; current = curr_header.previous;
} }
} }
@ -524,16 +524,23 @@ pub fn rewind_and_apply_fork(
debug!( debug!(
LOGGER, LOGGER,
"rewind_and_apply_fork @ {} [{}]", "rewind_and_apply_fork @ {} [{}], was @ {} [{}]",
forked_block.height, forked_block.height,
forked_block.hash(), forked_block.hash(),
b.header.height,
b.header.hash()
); );
// rewind the sum trees up to the forking block // rewind the sum trees up to the forking block
ext.rewind(&forked_block)?; ext.rewind(&forked_block)?;
debug!(
LOGGER,
"rewind_and_apply_fork: blocks on fork: {:?}", hashes
);
// apply all forked blocks, including this new one // apply all forked blocks, including this new one
for h in hashes { for (_, h) in hashes {
let fb = store let fb = store
.get_block(&h) .get_block(&h)
.map_err(|e| Error::StoreErr(e, format!("getting forked blocks")))?; .map_err(|e| Error::StoreErr(e, format!("getting forked blocks")))?;