Skip to content

Commit 07908cf

Browse files
committed
f - add CHANNEL_ANNOUNCEMENT_PROPAGATION_DELAY const
1 parent 89e7aa1 commit 07908cf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2910,6 +2910,11 @@ const MAX_NO_CHANNEL_PEERS: usize = 250;
29102910
/// become invalid over time as channels are closed. Thus, they are only suitable for short-term use.
29112911
pub const MAX_SHORT_LIVED_RELATIVE_EXPIRY: Duration = Duration::from_secs(60 * 60 * 24);
29122912

2913+
/// The number of blocks to wait for a channel_announcement to propagate such that payments using an
2914+
/// older SCID can still be relayed. Once the spend of the previous funding transaction has reached
2915+
/// this number of confirmations, the corresponding SCID will be forgotten.
2916+
const CHANNEL_ANNOUNCEMENT_PROPAGATION_DELAY: u32 = 12;
2917+
29132918
/// Used by [`ChannelManager::list_recent_payments`] to express the status of recent payments.
29142919
/// These include payments that have yet to find a successful path, or have unresolved HTLCs.
29152920
#[derive(Debug, PartialEq)]
@@ -11693,7 +11698,8 @@ where
1169311698
// Remove any scids used by old splice funding transactions
1169411699
let mut short_to_chan_info = self.short_to_chan_info.write().unwrap();
1169511700
channel.context.historical_scids.retain(|scid| {
11696-
let retain_scid = block_from_scid(*scid) + 12 > height;
11701+
let funding_height = block_from_scid(*scid);
11702+
let retain_scid = funding_height + CHANNEL_ANNOUNCEMENT_PROPAGATION_DELAY > height;
1169711703
if !retain_scid {
1169811704
short_to_chan_info.remove(scid);
1169911705
}

0 commit comments

Comments
 (0)