Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reorg typo #2352

Merged
merged 3 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ impl Index {
log::info!("{}", err.to_string());

match err.downcast_ref() {
Some(&ReorgError::Recoverable((height, depth))) => {
Some(&ReorgError::Recoverable { height, depth }) => {
Reorg::handle_reorg(self, height, depth)?;

updater = Updater::new(self)?;
Expand Down
6 changes: 3 additions & 3 deletions src/index/reorg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ use {super::*, updater::BlockData};

#[derive(Debug, PartialEq)]
pub(crate) enum ReorgError {
Recoverable((u64, u64)),
Recoverable { height: u64, depth: u64 },
Unrecoverable,
}

impl fmt::Display for ReorgError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
ReorgError::Recoverable((height, depth)) => {
ReorgError::Recoverable { height, depth } => {
write!(f, "{depth} block deep reorg detected at height {height}")
}
ReorgError::Unrecoverable => write!(f, "unrecoverable reorg detected"),
Expand Down Expand Up @@ -43,7 +43,7 @@ impl Reorg {
.into_option()?;

if index_block_hash == bitcoind_block_hash {
return Err(anyhow!(ReorgError::Recoverable((depth, height))));
return Err(anyhow!(ReorgError::Recoverable { height, depth }));
}
}

Expand Down
Loading