&PublicKey::from_secret_key(&secp_ctx, &chan_keys.delayed_payment_base_key),
&chan_keys.htlc_base_key,
BREAKDOWN_TIMEOUT, our_channel_monitor_claim_script);
- channel_monitor.set_their_htlc_base_key(&msg.htlc_basepoint);
+ channel_monitor.set_their_base_keys(&msg.htlc_basepoint, &msg.delayed_payment_basepoint);
channel_monitor.set_their_to_self_delay(msg.to_self_delay);
let mut chan = Channel {
// max_accepted_htlcs too small
// dust_limit_satoshis too small
- self.channel_monitor.set_their_htlc_base_key(&msg.htlc_basepoint);
+ self.channel_monitor.set_their_base_keys(&msg.htlc_basepoint, &msg.delayed_payment_basepoint);
self.their_dust_limit_satoshis = msg.dust_limit_satoshis;
self.their_max_htlc_value_in_flight_msat = cmp::min(msg.max_htlc_value_in_flight_msat, self.channel_value_satoshis * 1000);
key_storage: KeyStorage,
delayed_payment_base_key: PublicKey,
their_htlc_base_key: Option<PublicKey>,
+ their_delayed_payment_base_key: Option<PublicKey>,
// first is the idx of the first of the two revocation points
their_cur_revocation_points: Option<(u64, PublicKey, Option<PublicKey>)>,
key_storage: self.key_storage.clone(),
delayed_payment_base_key: self.delayed_payment_base_key.clone(),
their_htlc_base_key: self.their_htlc_base_key.clone(),
+ their_delayed_payment_base_key: self.their_delayed_payment_base_key.clone(),
their_cur_revocation_points: self.their_cur_revocation_points.clone(),
our_to_self_delay: self.our_to_self_delay,
self.key_storage != other.key_storage ||
self.delayed_payment_base_key != other.delayed_payment_base_key ||
self.their_htlc_base_key != other.their_htlc_base_key ||
+ self.their_delayed_payment_base_key != other.their_delayed_payment_base_key ||
self.their_cur_revocation_points != other.their_cur_revocation_points ||
self.our_to_self_delay != other.our_to_self_delay ||
self.their_to_self_delay != other.their_to_self_delay ||
},
delayed_payment_base_key: delayed_payment_base_key.clone(),
their_htlc_base_key: None,
+ their_delayed_payment_base_key: None,
their_cur_revocation_points: None,
our_to_self_delay: our_to_self_delay,
self.funding_txo = Some(funding_info);
}
- pub(super) fn set_their_htlc_base_key(&mut self, their_htlc_base_key: &PublicKey) {
+ /// We log these base keys at channel opening to being able to rebuild redeemscript in case of leaked revoked commit tx
+ pub(super) fn set_their_base_keys(&mut self, their_htlc_base_key: &PublicKey, their_delayed_payment_base_key: &PublicKey) {
self.their_htlc_base_key = Some(their_htlc_base_key.clone());
+ self.their_delayed_payment_base_key = Some(their_delayed_payment_base_key.clone());
}
pub(super) fn set_their_to_self_delay(&mut self, their_to_self_delay: u16) {
res.extend_from_slice(&self.delayed_payment_base_key.serialize());
res.extend_from_slice(&self.their_htlc_base_key.as_ref().unwrap().serialize());
+ res.extend_from_slice(&self.their_delayed_payment_base_key.as_ref().unwrap().serialize());
match self.their_cur_revocation_points {
Some((idx, pubkey, second_option)) => {
let delayed_payment_base_key = unwrap_obj!(PublicKey::from_slice(&secp_ctx, read_bytes!(33)));
let their_htlc_base_key = Some(unwrap_obj!(PublicKey::from_slice(&secp_ctx, read_bytes!(33))));
+ let their_delayed_payment_base_key = Some(unwrap_obj!(PublicKey::from_slice(&secp_ctx, read_bytes!(33))));
let their_cur_revocation_points = {
let first_idx = byte_utils::slice_to_be48(read_bytes!(6));
key_storage,
delayed_payment_base_key,
their_htlc_base_key,
+ their_delayed_payment_base_key,
their_cur_revocation_points,
our_to_self_delay,