- outpoint_to_channelmonitor.insert(
- OutPoint { txid: txid.unwrap(), index: index.unwrap() },
- (blockhash, channel_monitor),
- );
+ if channel_monitor.get_funding_txo().0.txid != txid.unwrap() || channel_monitor.get_funding_txo().0.index != index.unwrap() {
+ return Err(std::io::Error::new(std::io::ErrorKind::InvalidData, "ChannelMonitor was stored in the wrong file"));
+ }
+ res.push((blockhash, channel_monitor));