- if self.funding_txo.is_some() {
- // We should be able to compare the entire funding_txo, but in fuzztarget its trivially
- // easy to collide the funding_txo hash and have a different scriptPubKey.
- if other.funding_txo.is_some() && other.funding_txo.as_ref().unwrap().0 != self.funding_txo.as_ref().unwrap().0 {
- return Err(MonitorUpdateError("Funding transaction outputs are not identical!"));
- }
- } else {
- self.funding_txo = other.funding_txo.take();
+ match self.key_storage {
+ Storage::Local { ref funding_info, .. } => {
+ if funding_info.is_none() { return Err(MonitorUpdateError("Try to combine a Local monitor without funding_info")); }
+ let our_funding_info = funding_info;
+ if let Storage::Local { ref funding_info, .. } = other.key_storage {
+ if funding_info.is_none() { return Err(MonitorUpdateError("Try to combine a Local monitor without funding_info")); }
+ // We should be able to compare the entire funding_txo, but in fuzztarget its trivially
+ // easy to collide the funding_txo hash and have a different scriptPubKey.
+ if funding_info.as_ref().unwrap().0 != our_funding_info.as_ref().unwrap().0 {
+ return Err(MonitorUpdateError("Funding transaction outputs are not identical!"));
+ }
+ } else {
+ return Err(MonitorUpdateError("Try to combine a Local monitor with a Watchtower one !"));
+ }
+ },
+ Storage::Watchtower { .. } => {
+ if let Storage::Watchtower { .. } = other.key_storage {
+ unimplemented!();
+ } else {
+ return Err(MonitorUpdateError("Try to combine a Watchtower monitor with a Local one !"));
+ }
+ },