@@ -613,24 +613,15 @@ impl ChannelMonitor {
613
613
/// provides slightly better privacy.
614
614
/// It's the responsibility of the caller to register outpoint and script with passing the former
615
615
/// value as key to add_update_monitor.
616
- pub ( super ) fn set_funding_info ( & mut self , funding_info : ( OutPoint , Script ) ) {
617
- self . key_storage = match self . key_storage {
618
- Storage :: Local { ref revocation_base_key, ref htlc_base_key, ref delayed_payment_base_key, ref payment_base_key, ref shutdown_pubkey, ref prev_latest_per_commitment_point, ref latest_per_commitment_point, .. } => {
619
- Storage :: Local {
620
- revocation_base_key : * revocation_base_key,
621
- htlc_base_key : * htlc_base_key,
622
- delayed_payment_base_key : * delayed_payment_base_key,
623
- payment_base_key : * payment_base_key,
624
- shutdown_pubkey : * shutdown_pubkey,
625
- prev_latest_per_commitment_point : * prev_latest_per_commitment_point,
626
- latest_per_commitment_point : * latest_per_commitment_point,
627
- funding_info : Some ( funding_info. clone ( ) ) ,
628
- }
616
+ pub ( super ) fn set_funding_info ( & mut self , new_funding_info : ( OutPoint , Script ) ) {
617
+ match self . key_storage {
618
+ Storage :: Local { ref mut funding_info, .. } => {
619
+ * funding_info = Some ( new_funding_info) ;
629
620
} ,
630
621
Storage :: Watchtower { .. } => {
631
- unimplemented ! ( ) ;
622
+ panic ! ( "Channel somehow ended up with its internal ChannelMonitor being in Watchtower mode?" ) ;
632
623
}
633
- } ;
624
+ }
634
625
}
635
626
636
627
/// We log these base keys at channel opening to being able to rebuild redeemscript in case of leaked revoked commit tx
@@ -644,21 +635,12 @@ impl ChannelMonitor {
644
635
}
645
636
646
637
pub ( super ) fn unset_funding_info ( & mut self ) {
647
- self . key_storage = match self . key_storage {
648
- Storage :: Local { ref revocation_base_key, ref htlc_base_key, ref delayed_payment_base_key, ref payment_base_key, ref shutdown_pubkey, ref prev_latest_per_commitment_point, ref latest_per_commitment_point, .. } => {
649
- Storage :: Local {
650
- revocation_base_key : * revocation_base_key,
651
- htlc_base_key : * htlc_base_key,
652
- delayed_payment_base_key : * delayed_payment_base_key,
653
- payment_base_key : * payment_base_key,
654
- shutdown_pubkey : * shutdown_pubkey,
655
- prev_latest_per_commitment_point : * prev_latest_per_commitment_point,
656
- latest_per_commitment_point : * latest_per_commitment_point,
657
- funding_info : None ,
658
- }
638
+ match self . key_storage {
639
+ Storage :: Local { ref mut funding_info, .. } => {
640
+ * funding_info = None ;
659
641
} ,
660
642
Storage :: Watchtower { .. } => {
661
- unimplemented ! ( ) ;
643
+ panic ! ( "Channel somehow ended up with its internal ChannelMonitor being in Watchtower mode?" ) ;
662
644
} ,
663
645
}
664
646
}
0 commit comments