Skip to content

Commit 83ca899

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 83ca899

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lightning/src/ln/channelmanager.rs

+12
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,18 @@ 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`s for all HTLCs associated with the payment.
929+
fn get_channel_ids(&self) -> Vec<ChannelId> {
930+
self.htlcs.iter().map(|htlc| htlc.prev_hop.channel_id).collect()
931+
}
932+
933+
/// Returns the inbound `user_channel_id`s for all HTLCs associated with the payment.
934+
///
935+
/// Note: This list will be incomplete for HTLCs created using LDK version 0.0.112 or earlier.
936+
fn get_user_channel_ids(&self) -> Vec<u128> {
937+
self.htlcs.iter().filter_map(|htlc| htlc.prev_hop.user_channel_id).collect()
938+
}
927939
}
928940

929941
/// Represent the channel funding transaction type.

0 commit comments

Comments
 (0)