|
1 | 1 | use bytes::Bytes; |
2 | 2 | use hex::prelude::*; |
3 | 3 | use ldk_node::config::{ChannelConfig, MaxDustHTLCExposure}; |
| 4 | +use ldk_node::lightning::ln::types::ChannelId; |
4 | 5 | use ldk_node::payment::{PaymentDetails, PaymentDirection, PaymentKind, PaymentStatus}; |
5 | | -use ldk_node::{ChannelDetails, Event, LightningBalance, PendingSweepBalance}; |
| 6 | +use ldk_node::{ChannelDetails, Event, LightningBalance, PendingSweepBalance, UserChannelId}; |
6 | 7 | use ldk_server_protos::types::lightning_balance::BalanceType::{ |
7 | 8 | ClaimableAwaitingConfirmations, ClaimableOnChannelClose, ContentiousClaimable, |
8 | 9 | CounterpartyRevokedOutputClaimable, MaybePreimageClaimableHtlc, MaybeTimeoutClaimableHtlc, |
@@ -321,29 +322,20 @@ pub(crate) fn pending_sweep_balance_to_proto( |
321 | 322 | } |
322 | 323 | } |
323 | 324 |
|
324 | | -pub(crate) fn forwarded_payment_to_proto(payment_forwarded_event: Event) -> ForwardedPayment { |
325 | | - if let Event::PaymentForwarded { |
326 | | - prev_channel_id, |
327 | | - next_channel_id, |
328 | | - prev_user_channel_id, |
329 | | - next_user_channel_id, |
| 325 | +pub(crate) fn forwarded_payment_to_proto( |
| 326 | + prev_channel_id: ChannelId, next_channel_id: ChannelId, |
| 327 | + prev_user_channel_id: Option<UserChannelId>, next_user_channel_id: Option<UserChannelId>, |
| 328 | + total_fee_earned_msat: Option<u64>, skimmed_fee_msat: Option<u64>, claim_from_onchain_tx: bool, |
| 329 | + outbound_amount_forwarded_msat: Option<u64>, |
| 330 | +) -> ForwardedPayment { |
| 331 | + ForwardedPayment { |
| 332 | + prev_channel_id: prev_channel_id.to_string(), |
| 333 | + next_channel_id: next_channel_id.to_string(), |
| 334 | + prev_user_channel_id: prev_user_channel_id.expect("").0.to_string(), |
| 335 | + next_user_channel_id: next_user_channel_id.map(|u| u.0.to_string()), |
330 | 336 | total_fee_earned_msat, |
331 | 337 | skimmed_fee_msat, |
332 | 338 | claim_from_onchain_tx, |
333 | 339 | outbound_amount_forwarded_msat, |
334 | | - } = payment_forwarded_event |
335 | | - { |
336 | | - ForwardedPayment { |
337 | | - prev_channel_id: prev_channel_id.to_string(), |
338 | | - next_channel_id: next_channel_id.to_string(), |
339 | | - prev_user_channel_id: prev_user_channel_id.expect("").0.to_string(), |
340 | | - next_user_channel_id: next_user_channel_id.map(|u| u.0.to_string()), |
341 | | - total_fee_earned_msat, |
342 | | - skimmed_fee_msat, |
343 | | - claim_from_onchain_tx, |
344 | | - outbound_amount_forwarded_msat, |
345 | | - } |
346 | | - } else { |
347 | | - panic!("Expected Event::PaymentForwarded variant."); |
348 | 340 | } |
349 | 341 | } |
0 commit comments