Expand `ANTI_REORG_DELAY` docs to say its a library-wide assumption 2021-07-maturing-claims
authorMatt Corallo <git@bluematt.me>
Sun, 29 Aug 2021 19:01:05 +0000 (19:01 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 15 Sep 2021 18:07:34 +0000 (18:07 +0000)
lightning/src/chain/channelmonitor.rs

index 30e2793dcb9c2145648e32beadab177d45d24f8d..413d184b598c1c01564c3f3fb9350f402b87badf 100644 (file)
@@ -232,8 +232,13 @@ pub(crate) const CLTV_CLAIM_BUFFER: u32 = 18;
 /// with at worst this delay, so we are not only using this value as a mercy for them but also
 /// us as a safeguard to delay with enough time.
 pub(crate) const LATENCY_GRACE_PERIOD_BLOCKS: u32 = 3;
-/// Number of blocks we wait on seeing a HTLC output being solved before we fail corresponding inbound
-/// HTLCs. This prevents us from failing backwards and then getting a reorg resulting in us losing money.
+/// Number of blocks we wait on seeing a HTLC output being solved before we fail corresponding
+/// inbound HTLCs. This prevents us from failing backwards and then getting a reorg resulting in us
+/// losing money.
+///
+/// Note that this is a library-wide security assumption. If a reorg deeper than this number of
+/// blocks occurs, counterparties may be able to steal funds or claims made by and balances exposed
+/// by a  [`ChannelMonitor`] may be incorrect.
 // We also use this delay to be sure we can remove our in-flight claim txn from bump candidates buffer.
 // It may cause spurious generation of bumped claim txn but that's alright given the outpoint is already
 // solved by a previous claim tx. What we want to avoid is reorg evicting our claim tx and us not