@@ -52,7 +52,7 @@ use crate::ln::types::ChannelId;
5252use crate::types::payment::{PaymentHash, PaymentPreimage, PaymentSecret};
5353use crate::ln::channel::{self, Channel, ChannelError, ChannelUpdateStatus, FundedChannel, ShutdownResult, UpdateFulfillCommitFetch, OutboundV1Channel, ReconnectionMsg, InboundV1Channel, WithChannelContext};
5454use crate::ln::channel::PendingV2Channel;
55- use crate::ln::our_peer_storage::OurPeerStorage ;
55+ use crate::ln::our_peer_storage::EncryptedOurPeerStorage ;
5656use crate::ln::channel_state::ChannelDetails;
5757use crate::types::features::{Bolt12InvoiceFeatures, ChannelFeatures, ChannelTypeFeatures, InitFeatures, NodeFeatures};
5858#[cfg(any(feature = "_test_utils", test))]
@@ -8321,20 +8321,25 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
83218321 fn internal_peer_storage_retrieval(&self, counterparty_node_id: PublicKey, msg: msgs::PeerStorageRetrieval) -> Result<(), MsgHandleErrInternal> {
83228322 // TODO: Check if have any stale or missing ChannelMonitor.
83238323 let logger = WithContext::from(&self.logger, Some(counterparty_node_id), None, None);
8324+ let err = MsgHandleErrInternal::from_chan_no_close(
8325+ ChannelError::Ignore("Invalid PeerStorageRetrieval message received.".into()),
8326+ ChannelId([0; 32]),
8327+ );
8328+ let err_str = format!("Invalid PeerStorage received from {}", counterparty_node_id);
8329+
8330+ let encrypted_ops = match EncryptedOurPeerStorage::new(msg.data) {
8331+ Ok(encrypted_ops) => encrypted_ops,
8332+ Err(_) => {
8333+ log_debug!(logger, "{}", err_str);
8334+ return Err(err);
8335+ }
8336+ };
83248337
8325- let encrypted_ops = OurPeerStorage::EncryptedPeerStorage { cipher: msg.data };
8326- let decrypted_data = match encrypted_ops.decrypt_peer_storage(&self.node_signer.get_peer_storage_key()) {
8338+ let decrypted_data = match encrypted_ops.decrypt(&self.node_signer.get_peer_storage_key()) {
83278339 Ok(decrypted_ops) => decrypted_ops.into_vec(),
83288340 Err(_) => {
8329- log_debug!(
8330- logger,
8331- "Invalid PeerStorage received from {}",
8332- log_pubkey!(counterparty_node_id)
8333- );
8334- return Err(MsgHandleErrInternal::from_chan_no_close(
8335- ChannelError::Ignore("Invalid PeerStorageRetrieval message received.".into()),
8336- ChannelId([0; 32]),
8337- ));
8341+ log_debug!(logger, "{}", err_str);
8342+ return Err(err);
83388343 }
83398344 };
83408345
0 commit comments