Skip to content

Commit 823497d

Browse files
committed
Unify the update pattern in provide_latest_local_commitment_tx_info
1 parent 35bd8c3 commit 823497d

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/ln/channelmonitor.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -520,18 +520,12 @@ impl ChannelMonitor {
520520
feerate_per_kw,
521521
htlc_outputs,
522522
});
523-
self.key_storage = if let Storage::Local { ref revocation_base_key, ref htlc_base_key, ref delayed_payment_base_key, ref payment_base_key, ref shutdown_pubkey, ref latest_per_commitment_point, ref mut funding_info, .. } = self.key_storage {
524-
Storage::Local {
525-
revocation_base_key: *revocation_base_key,
526-
htlc_base_key: *htlc_base_key,
527-
delayed_payment_base_key: *delayed_payment_base_key,
528-
payment_base_key: *payment_base_key,
529-
shutdown_pubkey: *shutdown_pubkey,
530-
prev_latest_per_commitment_point: *latest_per_commitment_point,
531-
latest_per_commitment_point: Some(local_keys.per_commitment_point),
532-
funding_info: funding_info.take(),
533-
}
534-
} else { unimplemented!(); };
523+
524+
if let Storage::Local { ref mut latest_per_commitment_point, .. } = self.key_storage {
525+
*latest_per_commitment_point = Some(local_keys.per_commitment_point);
526+
} else {
527+
panic!("Channel somehow ended up with its internal ChannelMonitor being in Watchtower mode?");
528+
}
535529
}
536530

537531
/// Provides a payment_hash->payment_preimage mapping. Will be automatically pruned when all

0 commit comments

Comments
 (0)