From: Antoine Riard Date: Fri, 19 Jul 2019 21:57:17 +0000 (-0400) Subject: Fix: use our_to_self_delay in check_spend_remote_htlc X-Git-Tag: v0.0.12~200^2~3 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=3f409a8903d4da42a44ffddadf40c92ec5939d10;p=rust-lightning Fix: use our_to_self_delay in check_spend_remote_htlc We were previously using their_to_self_delay to regenerate scripts for spending remote revoked htlc transactions, and that's a bug. Their_to_self_delay is delay enforced by peer upon outputs returning funds back to us. Our_to_self_delay is delay enforced by us upon outputs returning funds back to peer. --- diff --git a/src/ln/channelmonitor.rs b/src/ln/channelmonitor.rs index 5dddd1e15..2c0a05804 100644 --- a/src/ln/channelmonitor.rs +++ b/src/ln/channelmonitor.rs @@ -1768,7 +1768,7 @@ impl ChannelMonitor { None => return (None, None), Some(their_delayed_payment_base_key) => ignore_error!(chan_utils::derive_public_key(&self.secp_ctx, &per_commitment_point, &their_delayed_payment_base_key)), }; - let redeemscript = chan_utils::get_revokeable_redeemscript(&revocation_pubkey, self.their_to_self_delay.unwrap(), &delayed_key); + let redeemscript = chan_utils::get_revokeable_redeemscript(&revocation_pubkey, self.our_to_self_delay, &delayed_key); let revokeable_p2wsh = redeemscript.to_v0_p2wsh(); let htlc_txid = tx.txid(); //TODO: This is gonna be a performance bottleneck for watchtowers!