mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 11:31:08 +03:00
log some more fork related info when rewinding and applying a fork (#884)
This commit is contained in:
parent
90c71625aa
commit
5bd0c251dc
1 changed files with 10 additions and 3 deletions
|
@ -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")))?;
|
||||||
|
|
Loading…
Reference in a new issue