Skip to content

fix: correct exchange rate calculation for taken range orders#2344

Merged
KoalaSat merged 1 commit intoRoboSats:mainfrom
keshav0479:fix/range-order-calculation
Jan 6, 2026
Merged

fix: correct exchange rate calculation for taken range orders#2344
KoalaSat merged 1 commit intoRoboSats:mainfrom
keshav0479:fix/range-order-calculation

Conversation

@keshav0479
Copy link
Contributor

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_amount whenever has_range was true, even after the order was taken and amount was set to the actual taken value. This caused a math mismatch:

  • satoshis_now was computed for the taken amount (eg 800 EUR)
  • rate was computed incorrectly using max_amount (eg 1000 EUR)

Fix

Changed the rate calculation to prioritize order.amount (the actual taken amount) when available. It falls back to max_amount only for untaken range orders.

Copy link
Member

@KoalaSat KoalaSat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

@KoalaSat KoalaSat merged commit 58fa690 into RoboSats:main Jan 6, 2026
1 check passed
@keshav0479
Copy link
Contributor Author

keshav0479 commented Jan 6, 2026

Thank you @KoalaSat! I really appreciate the review and the tip.

lnbc350u1p54e7happ5pxjgfjehf2uw3kj0p8x3cudyk3pyf9w69tsdyd2stfesx8h6p2xqcqzyssp5djelhlapyhgdre040ulwq7raml9efm5xauv9l6n8s9hp6nxjpqrq9q7sqqqqqqqqqqqqqqqqqqqsqqqqqysgqdqqmqz9gxqyjw5qrzjqwryaup9lh50kkranzgcdnn2fgvx390wgj5jd07rwr3vxeje0glcll63a0scqz7stsqqqqlgqqqqqeqqjqxvjgjpcq6hrwwj9ugyjpavukl7sun0pfut4ghzcwku60264ldepx2tss8v4a4yv7jnfnpn87v2y8m9wesdtj6kngcrgqkepzakcfc8cq49008x

@RobosatsDevFund
Copy link

@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.

@keshav0479
Copy link
Contributor Author

@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.

lnbc350u1p54lqtkpp5p8lgw566cpujcf2umd002jvyw3psetrms53fmj3fss79a9h2xy5sdqqcqzzsxqyz5vqsp5qvda07ev5qavmrlj2we5w75p7etfaw3l08vp6axp452pu6j3227q9qxpqysgqcx8l6sd6kwlvn7d2v9pjtsgma5gfvgctr0847aqgjdg4xeyglx95wvj5jetzz5palzg6gmtht9nj8g8av9nxdqxjdlk74srxppe0m4speefc5n

@RobosatsDevFund
Copy link

7390939451b5ae8f9942040ba440325e463d1656553f327f530908e81be098ab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: order summary: incorrect "You receive" amount

3 participants