Skip to content

Commit

Permalink
Merge pull request #2317 from get10101/fix/confirmation-calculation
Browse files Browse the repository at this point in the history
Compute confirmations correctly
  • Loading branch information
luckysori authored Mar 25, 2024
2 parents 55753a3 + 8b7564d commit efcdc35
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions crates/ln-dlc-node/src/on_chain_wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,8 @@ impl<D> OnChainWallet<D> {

let tip = self.get_tip();
let n_confirmations = match tip.checked_sub(confirmation_height) {
Some(diff) => NonZeroU32::new(diff).unwrap_or({
// Being included in a block counts as a confirmation!
NonZeroU32::new(1).expect("non-zero value")
}),
// Being included in a block counts as a confirmation!
Some(diff) => NonZeroU32::new(diff + 1).expect("non-zero"),
None => {
// The transaction shouldn't be ahead of the tip!
debug_assert!(false);
Expand Down

0 comments on commit efcdc35

Please sign in to comment.