Skip to content

Commit 6afd4fa

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 6afd4fa

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lightning/src/ln/channelmanager.rs

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

929943
/// Represent the channel funding transaction type.

0 commit comments

Comments
 (0)