Skip to content

Commit

Permalink
fixup! Start publishing PaymentForwarded events.
Browse files Browse the repository at this point in the history
  • Loading branch information
G8XSU committed Nov 26, 2024
1 parent 7585934 commit 1d0aec2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ impl_writeable_tlv_based_enum!(Event,
(7, PaymentForwarded) => {
(0, prev_channel_id, required),
(2, next_channel_id, required),
(4, prev_user_channel_id, required),
(4, prev_user_channel_id, option),
(6, next_user_channel_id, option),
(8, total_fee_earned_msat, option),
(10, skimmed_fee_msat, option),
Expand Down Expand Up @@ -1139,20 +1139,17 @@ where
let event = Event::PaymentForwarded {
prev_channel_id: prev_channel_id.expect("prev_channel_id expected for events generated by LDK versions greater than 0.0.107."),
next_channel_id: next_channel_id.expect("next_channel_id expected for events generated by LDK versions greater than 0.0.107."),
prev_user_channel_id: prev_user_channel_id.map(|u|UserChannelId(u)),
next_user_channel_id: next_user_channel_id.map(|u| UserChannelId(u)),
prev_user_channel_id: prev_user_channel_id.map(UserChannelId),
next_user_channel_id: next_user_channel_id.map(UserChannelId),
total_fee_earned_msat,
skimmed_fee_msat,
claim_from_onchain_tx,
outbound_amount_forwarded_msat,
};
match self.event_queue.add_event(event) {
Ok(_) => {},
Err(e) => {
log_error!(self.logger, "Failed to push to event queue: {}", e);
return Err(ReplayEvent());
},
};
self.event_queue.add_event(event).map_err(|e| {
log_error!(self.logger, "Failed to push to event queue: {}", e);
ReplayEvent()
})?;

let read_only_network_graph = self.network_graph.read_only();
let nodes = read_only_network_graph.nodes();
Expand Down
3 changes: 3 additions & 0 deletions tests/integration_tests_rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ fn multi_hop_sending() {
let invoice = nodes[4].bolt11_payment().receive(2_500_000, &"asdf", 9217).unwrap();
nodes[0].bolt11_payment().send(&invoice, Some(sending_params)).unwrap();

expect_event!(nodes[1], PaymentForwarded);
expect_event!(nodes[2], PaymentForwarded);

let payment_id = expect_payment_received_event!(&nodes[4], 2_500_000);
let fee_paid_msat = Some(2000);
expect_payment_successful_event!(nodes[0], payment_id, Some(fee_paid_msat));
Expand Down

0 comments on commit 1d0aec2

Please sign in to comment.