Skip to content

Commit

Permalink
Merge pull request #277 from nomic-io/checkpoint-index-progression
Browse files Browse the repository at this point in the history
Check all keys before progressing index
  • Loading branch information
mappum authored Feb 12, 2024
2 parents 483fd66 + 9e68002 commit a84f9a6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/bitcoin/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,21 +255,23 @@ where

info!("Starting checkpoint signer...");
loop {
let mut signed = false;

for (xpub, xpriv) in key_pairs.iter() {
let signed = match self.try_sign_checkpoint(xpub, xpriv, index).await {
signed |= match self.try_sign_checkpoint(xpub, xpriv, index).await {
Ok(signed) => signed,
Err(e) => {
ERROR_COUNTER.inc();
eprintln!("Signer error: {}", e);
false
}
};
}

if signed {
index += 1;
} else {
tokio::time::sleep(std::time::Duration::from_secs(5)).await;
}
if signed {
index += 1;
} else {
tokio::time::sleep(std::time::Duration::from_secs(5)).await;
}
}
}
Expand Down

0 comments on commit a84f9a6

Please sign in to comment.