Skip to content

Commit e61f68b

Browse files
committed
Introduce ClaimablePayment utilities
These two utilities will be used in following commit to get all the inbound channel_ids, and user_channel_ids associated with all the parts of a payment.
1 parent 5bc9ffa commit e61f68b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,15 @@ impl ClaimablePayment {
924924
self.htlcs.iter().map(|htlc| (htlc.prev_hop.channel_id, htlc.prev_hop.htlc_id))
925925
)
926926
}
927+
928+
/// Returns the inbound `(channel_id, user_channel_id)` pairs for all HTLCs associated with the payment.
929+
///
930+
/// Note: The `user_channel_id` will be `None` for HTLCs created using LDK version 0.0.117 or prior.
931+
fn inbound_channel_ids(&self) -> Vec<(ChannelId, Option<u128>)> {
932+
self.htlcs.iter().map(|htlc| {
933+
(htlc.prev_hop.channel_id, htlc.prev_hop.user_channel_id)
934+
}).collect()
935+
}
927936
}
928937

929938
/// Represent the channel funding transaction type.

0 commit comments

Comments
 (0)