Skip to content

Commit a0edd81

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 a0edd81

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: lightning/src/ln/channelmanager.rs

+10
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,16 @@ 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<Option<ChannelId>> {
930+
self.htlcs.iter().map(|htlc| Some(htlc.prev_hop.channel_id)).collect()
931+
}
932+
933+
/// Returns the inbound `user_channel_id`s for all HTLCs associated with the payment.
934+
fn get_user_channel_ids(&self) -> Vec<Option<u128>> {
935+
self.htlcs.iter().map(|htlc| htlc.prev_hop.user_channel_id).collect()
936+
}
927937
}
928938

929939
/// Represent the channel funding transaction type.

0 commit comments

Comments
 (0)