Skip to content

Commit

Permalink
Merge pull request #641 from breez/fix-chain-swap-fee-display
Browse files Browse the repository at this point in the history
Fix fees shown for send chain swaps
  • Loading branch information
danielgranhao authored Jan 7, 2025
2 parents 8897352 + a9ec1c0 commit eadcdbf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/core/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1538,7 +1538,13 @@ impl Payment {
.unwrap_or(utils::now()),
amount_sat: tx.amount_sat,
fees_sat: match swap.as_ref() {
Some(s) => s.payer_amount_sat - tx.amount_sat,
Some(s) => match tx.payment_type {
// For receive swaps, to avoid some edge case issues related to potential past
// overpayments, we use the actual claim value as the final received amount
// for fee calculation.
PaymentType::Receive => s.payer_amount_sat - tx.amount_sat,
PaymentType::Send => s.payer_amount_sat - s.receiver_amount_sat,
},
None => match tx.payment_type {
PaymentType::Receive => 0,
PaymentType::Send => tx.fees_sat,
Expand Down

0 comments on commit eadcdbf

Please sign in to comment.