fix: correct exchange rate calculation for taken range orders#2344
fix: correct exchange rate calculation for taken range orders#2344KoalaSat merged 1 commit intoRoboSats:mainfrom
Conversation
KoalaSat
left a comment
There was a problem hiding this comment.
@keshav0479 Thanks for taking care of this!
Please accept a small tip for your work. Share here a LN invoice with long expiration date for 35,000 sats
|
Thank you @KoalaSat! I really appreciate the review and the tip. lnbc350u1p54e7happ5pxjgfjehf2uw3kj0p8x3cudyk3pyf9w69tsdyd2stfesx8h6p2xqcqzyssp5djelhlapyhgdre040ulwq7raml9efm5xauv9l6n8s9hp6nxjpqrq9q7sqqqqqqqqqqqqqqqqqqqsqqqqqysgqdqqmqz9gxqyjw5qrzjqwryaup9lh50kkranzgcdnn2fgvx390wgj5jd07rwr3vxeje0glcll63a0scqz7stsqqqqlgqqqqqeqqjqxvjgjpcq6hrwwj9ugyjpavukl7sun0pfut4ghzcwku60264ldepx2tss8v4a4yv7jnfnpn87v2y8m9wesdtj6kngcrgqkepzakcfc8cq49008x |
|
@keshav0479 Seems like it is not possible to pay this invoice due to either your channels are full and your node is and Robosats' node is poorly connected. You can try with a proxy wallet. |
|
|
7390939451b5ae8f9942040ba440325e463d1656553f327f530908e81be098ab |
Fixes #2336
Problem
For range orders, the "You receive" satoshi amount in the Order tab showed an incorrect (lower) value after the order was taken.
Cause
The rate calculation used
max_amountwheneverhas_rangewas true, even after the order was taken andamountwas set to the actual taken value. This caused a math mismatch:satoshis_nowwas computed for the taken amount (eg 800 EUR)ratewas computed incorrectly usingmax_amount(eg 1000 EUR)Fix
Changed the rate calculation to prioritize
order.amount(the actual taken amount) when available. It falls back tomax_amountonly for untaken range orders.