@@ -243,7 +243,6 @@ enum Storage {
243
243
Watchtower {
244
244
revocation_base_key : PublicKey ,
245
245
htlc_base_key : PublicKey ,
246
- sigs : HashMap < Sha256dHash , Signature > ,
247
246
}
248
247
}
249
248
@@ -545,54 +544,29 @@ impl ChannelMonitor {
545
544
/// After a successful call this ChannelMonitor is up-to-date and is safe to use to monitor the
546
545
/// chain for new blocks/transactions.
547
546
pub fn insert_combine ( & mut self , mut other : ChannelMonitor ) -> Result < ( ) , MonitorUpdateError > {
548
-
549
- self . key_storage = match self . key_storage {
550
- 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, ref mut funding_info, .. } => {
551
-
552
- macro_rules! new_storage_local {
553
- ( $funding_info: expr) => {
554
- Storage :: Local {
555
- revocation_base_key: * revocation_base_key,
556
- htlc_base_key: * htlc_base_key,
557
- delayed_payment_base_key: * delayed_payment_base_key,
558
- payment_base_key: * payment_base_key,
559
- shutdown_pubkey: * shutdown_pubkey,
560
- prev_latest_per_commitment_point: * prev_latest_per_commitment_point,
561
- latest_per_commitment_point: * latest_per_commitment_point,
562
- funding_info: $funding_info,
563
- }
564
- }
565
- }
566
-
547
+ match self . key_storage {
548
+ Storage :: Local { ref funding_info, .. } => {
549
+ if funding_info. is_none ( ) { return Err ( MonitorUpdateError ( "Try to combine a Local monitor without funding_info" ) ) ; }
567
550
let our_funding_info = funding_info;
568
- if let Storage :: Local { ref mut funding_info, .. } = other. key_storage {
569
- if our_funding_info . is_some ( ) {
551
+ if let Storage :: Local { ref funding_info, .. } = other. key_storage {
552
+ if funding_info . is_none ( ) { return Err ( MonitorUpdateError ( "Try to combine a Local monitor without funding_info" ) ) ; }
570
553
// We should be able to compare the entire funding_txo, but in fuzztarget its trivially
571
554
// easy to collide the funding_txo hash and have a different scriptPubKey.
572
- if funding_info. is_some ( ) && our_funding_info. is_some ( ) && funding_info. as_ref ( ) . unwrap ( ) . 0 != our_funding_info. as_ref ( ) . unwrap ( ) . 0 {
573
- return Err ( MonitorUpdateError ( "Funding transaction outputs are not identical!" ) ) ;
574
- } else {
575
- new_storage_local ! ( our_funding_info. take( ) )
576
- }
577
- } else {
578
- return Err ( MonitorUpdateError ( "Try to combine a Local monitor without funding_info" ) ) ;
555
+ if funding_info. as_ref ( ) . unwrap ( ) . 0 != our_funding_info. as_ref ( ) . unwrap ( ) . 0 {
556
+ return Err ( MonitorUpdateError ( "Funding transaction outputs are not identical!" ) ) ;
579
557
}
580
558
} else {
581
559
return Err ( MonitorUpdateError ( "Try to combine a Local monitor with a Watchtower one !" ) ) ;
582
560
}
583
561
} ,
584
562
Storage :: Watchtower { .. } => {
585
- if let Storage :: Watchtower { ref revocation_base_key, ref htlc_base_key, ref mut sigs } = other. key_storage {
586
- Storage :: Watchtower {
587
- revocation_base_key : * revocation_base_key,
588
- htlc_base_key : * htlc_base_key,
589
- sigs : sigs. drain ( ) . collect ( ) ,
590
- }
563
+ if let Storage :: Watchtower { .. } = other. key_storage {
564
+ unimplemented ! ( ) ;
591
565
} else {
592
566
return Err ( MonitorUpdateError ( "Try to combine a Watchtower monitor with a Local one !" ) ) ;
593
567
}
594
568
} ,
595
- } ;
569
+ }
596
570
let other_min_secret = other. get_min_seen_secret ( ) ;
597
571
let our_min_secret = self . get_min_seen_secret ( ) ;
598
572
if our_min_secret > other_min_secret {
0 commit comments