From 1d0aec25d7710b383798a393660ac465357b1df4 Mon Sep 17 00:00:00 2001 From: G8XSU <3442979+G8XSU@users.noreply.github.com> Date: Tue, 26 Nov 2024 09:01:38 -0800 Subject: [PATCH] fixup! Start publishing PaymentForwarded events. --- src/event.rs | 17 +++++++---------- tests/integration_tests_rust.rs | 3 +++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/event.rs b/src/event.rs index a50757be9..f3b0295a7 100644 --- a/src/event.rs +++ b/src/event.rs @@ -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), @@ -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(); diff --git a/tests/integration_tests_rust.rs b/tests/integration_tests_rust.rs index 31990440e..937af241b 100644 --- a/tests/integration_tests_rust.rs +++ b/tests/integration_tests_rust.rs @@ -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));