@@ -52,7 +52,7 @@ use crate::ln::types::ChannelId;
52
52
use crate::types::payment::{PaymentHash, PaymentPreimage, PaymentSecret};
53
53
use crate::ln::channel::{self, Channel, ChannelError, ChannelUpdateStatus, FundedChannel, ShutdownResult, UpdateFulfillCommitFetch, OutboundV1Channel, ReconnectionMsg, InboundV1Channel, WithChannelContext};
54
54
use crate::ln::channel::PendingV2Channel;
55
- use crate::ln::our_peer_storage::OurPeerStorage ;
55
+ use crate::ln::our_peer_storage::EncryptedOurPeerStorage ;
56
56
use crate::ln::channel_state::ChannelDetails;
57
57
use crate::types::features::{Bolt12InvoiceFeatures, ChannelFeatures, ChannelTypeFeatures, InitFeatures, NodeFeatures};
58
58
#[cfg(any(feature = "_test_utils", test))]
@@ -8321,20 +8321,25 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
8321
8321
fn internal_peer_storage_retrieval(&self, counterparty_node_id: PublicKey, msg: msgs::PeerStorageRetrieval) -> Result<(), MsgHandleErrInternal> {
8322
8322
// TODO: Check if have any stale or missing ChannelMonitor.
8323
8323
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
+ };
8324
8337
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()) {
8327
8339
Ok(decrypted_ops) => decrypted_ops.into_vec(),
8328
8340
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);
8338
8343
}
8339
8344
};
8340
8345
0 commit comments