Skip to content

Commit 539271a

Browse files
committed
f LDK: Account for PaymentForwarded event adding {prev,next}_node_id
1 parent 1f4319a commit 539271a

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

bindings/ldk_node.udl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ interface Event {
280280
PaymentFailed(PaymentId? payment_id, PaymentHash? payment_hash, PaymentFailureReason? reason);
281281
PaymentReceived(PaymentId? payment_id, PaymentHash payment_hash, u64 amount_msat, sequence<CustomTlvRecord> custom_records);
282282
PaymentClaimable(PaymentId payment_id, PaymentHash payment_hash, u64 claimable_amount_msat, u32? claim_deadline, sequence<CustomTlvRecord> custom_records);
283-
PaymentForwarded(ChannelId prev_channel_id, ChannelId next_channel_id, UserChannelId? prev_user_channel_id, UserChannelId? next_user_channel_id, u64? total_fee_earned_msat, u64? skimmed_fee_msat, boolean claim_from_onchain_tx, u64? outbound_amount_forwarded_msat);
283+
PaymentForwarded(ChannelId prev_channel_id, ChannelId next_channel_id, UserChannelId?
284+
prev_user_channel_id, UserChannelId? next_user_channel_id, PublicKey? prev_node_id, PublicKey? next_node_id, u64? total_fee_earned_msat, u64? skimmed_fee_msat, boolean claim_from_onchain_tx, u64? outbound_amount_forwarded_msat);
284285
ChannelPending(ChannelId channel_id, UserChannelId user_channel_id, ChannelId former_temporary_channel_id, PublicKey counterparty_node_id, OutPoint funding_txo);
285286
ChannelReady(ChannelId channel_id, UserChannelId user_channel_id, PublicKey? counterparty_node_id);
286287
ChannelClosed(ChannelId channel_id, UserChannelId user_channel_id, PublicKey? counterparty_node_id, ClosureReason? reason);

src/event.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@ pub enum Event {
120120
/// This will be `None` if the payment was settled via an on-chain transaction. See the
121121
/// caveat described for the `total_fee_earned_msat` field.
122122
next_user_channel_id: Option<UserChannelId>,
123+
/// The node id of the previous node.
124+
///
125+
/// This is only `None` for HTLCs received prior to LDK Node v0.5 or for events serialized by
126+
/// versions prior to v0.5.
127+
prev_node_id: Option<PublicKey>,
128+
/// The node id of the next node.
129+
///
130+
/// This is only `None` for HTLCs received prior to LDK Node v0.5 or for events serialized by
131+
/// versions prior to v0.5.
132+
next_node_id: Option<PublicKey>,
123133
/// The total fee, in milli-satoshis, which was earned as a result of the payment.
124134
///
125135
/// Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
@@ -257,7 +267,9 @@ impl_writeable_tlv_based_enum!(Event,
257267
},
258268
(7, PaymentForwarded) => {
259269
(0, prev_channel_id, required),
270+
(1, prev_node_id, option),
260271
(2, next_channel_id, required),
272+
(3, next_node_id, option),
261273
(4, prev_user_channel_id, option),
262274
(6, next_user_channel_id, option),
263275
(8, total_fee_earned_msat, option),
@@ -1139,6 +1151,8 @@ where
11391151
next_channel_id,
11401152
prev_user_channel_id,
11411153
next_user_channel_id,
1154+
prev_node_id,
1155+
next_node_id,
11421156
total_fee_earned_msat,
11431157
skimmed_fee_msat,
11441158
claim_from_onchain_tx,
@@ -1149,6 +1163,8 @@ where
11491163
next_channel_id: next_channel_id.expect("next_channel_id expected for events generated by LDK versions greater than 0.0.107."),
11501164
prev_user_channel_id: prev_user_channel_id.map(UserChannelId),
11511165
next_user_channel_id: next_user_channel_id.map(UserChannelId),
1166+
prev_node_id,
1167+
next_node_id,
11521168
total_fee_earned_msat,
11531169
skimmed_fee_msat,
11541170
claim_from_onchain_tx,

0 commit comments

Comments
 (0)