Skip to content

Commit e773141

Browse files
committed
f - take the SCID of the oldest channel
1 parent 2daca10 commit e773141

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lightning/src/ln/channel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1403,7 +1403,7 @@ pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
14031403
/// Either the height at which this channel was created or the height at which it was last
14041404
/// serialized if it was serialized by versions prior to 0.0.103.
14051405
/// We use this to close if funding is never broadcasted.
1406-
channel_creation_height: u32,
1406+
pub(super) channel_creation_height: u32,
14071407

14081408
counterparty_dust_limit_satoshis: u64,
14091409

lightning/src/ln/channelmanager.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9007,7 +9007,8 @@ where
90079007
node_id: *node_id,
90089008
short_channel_id: peer.channel_by_id
90099009
.iter()
9010-
.find(|(_, channel)| channel.context().is_usable())
9010+
.filter(|(_, channel)| channel.context().is_usable())
9011+
.min_by_key(|(_, channel)| channel.context().channel_creation_height)
90119012
.and_then(|(_, channel)| channel.context().get_short_channel_id()),
90129013
})
90139014
.collect::<Vec<_>>();

0 commit comments

Comments
 (0)