Skip to content

Commit fd14bc2

Browse files
committed
f - prefer scid with smallest block height
1 parent c2a37a5 commit fd14bc2

File tree

1 file changed

+3
-1
lines changed
  • lightning/src/blinded_path

1 file changed

+3
-1
lines changed

lightning/src/blinded_path/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use crate::offers::invoice::BlindedPayInfo;
2121
use crate::routing::gossip::{NodeId, ReadOnlyNetworkGraph};
2222
use crate::sign::EntropySource;
2323
use crate::util::ser::{Readable, Writeable, Writer};
24+
use crate::util::scid_utils;
2425

2526
use crate::io;
2627
use crate::prelude::*;
@@ -231,7 +232,8 @@ impl BlindedPath {
231232
if let Some((scid, channel_info)) = node_info
232233
.channels
233234
.iter()
234-
.find_map(|scid| network_graph.channel(*scid).map(|info| (*scid, info)))
235+
.filter_map(|scid| network_graph.channel(*scid).map(|info| (*scid, info)))
236+
.min_by_key(|(scid, _)| scid_utils::block_from_scid(*scid))
235237
{
236238
let direction = if node_id == channel_info.node_one {
237239
Direction::NodeOne

0 commit comments

Comments
 (0)