Skip to content

Commit 36e9725

Browse files
committed
Provide guidance on ChannelMonitorUpdate serialized size
Users need to make decisions about storage sizing and we need to have advice on the maximum size of various things users need to store. ChannelMonitorUpdates are likely the worst case of this, they're usually at max a few KB, but can get up to a few hundred KB for commitment transactions that have 400+ HTLCs pending. We had one user report an update (likely) going over 400 KiB, which isn't immediately obvious to me is practical, but its within a few multiples of trivially-reachable sizes, so its likely that did occur. To be on the safe side, we simply recommend users ensure they can support "upwards of 1 MiB" here.
1 parent d024251 commit 36e9725

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,13 @@ use io::{self, Error};
5757
use core::ops::Deref;
5858
use sync::Mutex;
5959

60-
/// An update generated by the underlying Channel itself which contains some new information the
61-
/// ChannelMonitor should be made aware of.
60+
/// An update generated by the underlying channel itself which contains some new information the
61+
/// [`ChannelMonitor`] should be made aware of.
62+
///
63+
/// Because this represents only a small number of updates to the underlying state, it is generally
64+
/// much smaller than a full [`ChannelMonitor`]. However, for large single commitment transaction
65+
/// updates (e.g. ones during which there are hundreds of HTLCs pending on the commitment
66+
/// transaction), a single update may reach upwards of 1 MiB in serialized size.
6267
#[cfg_attr(any(test, fuzzing, feature = "_test_utils"), derive(PartialEq))]
6368
#[derive(Clone)]
6469
#[must_use]

0 commit comments

Comments
 (0)