Skip to content

fix: prevent satoshis_now overwrite in OrderView#2414

Open
FedericoLuque wants to merge 2 commits intoRoboSats:mainfrom
FedericoLuque:fix/2412-incorrect-amount-range-order
Open

fix: prevent satoshis_now overwrite in OrderView#2414
FedericoLuque wants to merge 2 commits intoRoboSats:mainfrom
FedericoLuque:fix/2412-incorrect-amount-range-order

Conversation

@FedericoLuque
Copy link
Copy Markdown
Contributor

@FedericoLuque FedericoLuque commented Feb 4, 2026

What does this PR do?

Fixes #2412

This PR fixes a bug in api/views.py where the satoshis_now value was being unconditionally overwritten by order.last_satoshis at the end of the OrderView processing.

Checklist before merging

  • Install pre-commit and initialize it: pip install pre-commit, then pre-commit install. Pre-commit installs git hooks that automatically check the codebase. If pre-commit fails when you commit your changes, please fix the problems it points out.

@KoalaSat
Copy link
Copy Markdown
Member

KoalaSat commented Feb 5, 2026

@FedericoLuque Can you add some test cases to tests/test_trade_pipeline.py ?

Comment thread api/views.py
take_order.exists()
and order.status >= Order.Status.PUB
and order.status < Order.Status.WF2
):
Copy link
Copy Markdown
Member

@KoalaSat KoalaSat Feb 5, 2026

Choose a reason for hiding this comment

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

Adding not(...) with and inside is always confusing, better to just negate take_order.exists() and add regular ands for status

@FedericoLuque
Copy link
Copy Markdown
Contributor Author

@KoalaSat I haven't been able to deploy the application locally to visually verify the change; I've had a lot of trouble trying. But the tests I've created are passing.

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.

Incorrect amount calculation when taking an order

2 participants