-
Notifications
You must be signed in to change notification settings - Fork 212
Description
Describe the bug
In Logics.confirm_fiat, the proceeds are calculated, considering the payout amount and the routing fees, but this calculation might happen before the payout invoice is settled, which causes this logic to use 0 as routing fee.
The proceeds are also used to calculate the dev fund donation, which might cause the coordinator to operate on a loss.
Expected behavior
Proceeds should only be calculated once the payout invoice is settled.
Additional context
For one of my orders I can see in the logs: "proceedings are incremented by 37 Sats, totalling 37 Sats", but if I calculate the expression int(order.trade_escrow.num_satoshis - payout_sats), I get 35. The fees were Decimal('1.444').
On another order I see "proceedings are incremented by 355 Sats, totalling 355 Sats", but the actual proceeds were 132. The dev fund donation was 71, but it should have been 26.