Skip to content

Commit 7a6306b

Browse files
committed
fixup: Enable ChainMonitor to distribute PeerStorage
1 parent 7abc134 commit 7a6306b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lightning-liquidity/tests/common/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,10 @@ pub(crate) fn create_liquidity_node(
469469
chan_handler: Arc::new(test_utils::TestChannelMessageHandler::new(
470470
ChainHash::using_genesis_block(Network::Testnet),
471471
)),
472-
send_only_message_handler: Arc::clone(&chain_monitor),
473472
route_handler: Arc::new(test_utils::TestRoutingMessageHandler::new()),
474473
onion_message_handler: IgnoringMessageHandler {},
475474
custom_message_handler: Arc::clone(&liquidity_manager),
475+
send_only_message_handler: Arc::clone(&chain_monitor),
476476
};
477477
let peer_manager =
478478
Arc::new(PeerManager::new(msg_handler, 0, &seed, logger.clone(), keys_manager.clone()));

lightning/src/chain/chainmonitor.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ pub struct ChainMonitor<ChannelSigner: EcdsaChannelSigner, C: Deref, T: Deref, F
258258
/// A [`Notifier`] used to wake up the background processor in case we have any [`Event`]s for
259259
/// it to give to users (or [`MonitorEvent`]s for `ChannelManager` to process).
260260
event_notifier: Notifier,
261+
262+
/// Messages to send to the peer. This is currently used to distribute PeerStorage to channel partners.
261263
pending_send_only_events: Mutex<Vec<MessageSendEvent>>,
262264

263265
our_peerstorage_encryption_key: PeerStorageKey,
@@ -397,12 +399,16 @@ where C::Target: chain::Filter,
397399
/// transactions relevant to the watched channels.
398400
///
399401
/// # Note
400-
/// `our_peerstorage_encryption_key` must be obtained from [`crate::sign::NodeSigner::get_peer_storage_key()`].
402+
/// `our_peerstorage_encryption_key` must be obtained from [`NodeSigner::get_peer_storage_key`].
401403
/// This key is used to encrypt peer storage backups.
402404
///
403405
/// **Important**: This key should not be set arbitrarily or changed after initialization. The same key
404-
/// is obtained by the `ChannelManager` through `KeyMananger` to decrypt peer backups.
406+
/// is obtained by the [`ChannelManager`] through [`KeysManager`] to decrypt peer backups.
405407
/// Using an inconsistent or incorrect key will result in the inability to decrypt previously encrypted backups.
408+
///
409+
/// [`NodeSigner::get_peer_storage_key`]: crate::sign::NodeSigner::get_peer_storage_key
410+
/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
411+
/// [`KeysManager`]: crate::sign::KeysManager
406412
pub fn new(chain_source: Option<C>, broadcaster: T, logger: L, feeest: F, persister: P, entropy_source: ES, our_peerstorage_encryption_key: PeerStorageKey) -> Self {
407413
Self {
408414
monitors: RwLock::new(new_hash_map()),

0 commit comments

Comments
 (0)