Skip to content

Commit f96ccd9

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 f96ccd9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ use sync::Mutex;
5959

6060
/// An update generated by the underlying Channel itself which contains some new information the
6161
/// ChannelMonitor should be made aware of.
62+
///
63+
/// Because these represent only a small number of updates to the underlying state, they are
64+
/// generally much smaller than a full [`ChannelMonitor`]. However, for large single commitment
65+
/// transaction updates (e.g. ones during which there are hundreds of HTLCs pending on the
66+
/// commitment 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)