Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server/market: startup balance checks must convert base to quote #2312

Merged
merged 1 commit into from Apr 19, 2023

Conversation

chappjc
Copy link
Member

@chappjc chappjc commented Apr 18, 2023

When an account-based asset is the quote asset in a market, and there is a booked buy order, the quantity to check must be in units of the quote asset (the account-based asset).

Test/repro: On the simnet harness fund your wallet with something like 0.39 ETH. On the DCR-ETH market, book a buy order at 0.01 ETH/DCR for 1 lot, which should say "Total: 0.10 ETH".
Stop the server process and start again with ./run. It would unbook the order because it was comparing the base asset (10 DCR or 1000000000 atoms) with the eth balance of 0.039 ETH (390000000 gwei).

With this change, it will compare quote units (plus fees) against balance.

When an account-based asset is the quote asset in a market, and there is
a booked buy order, the quantity to check must be in units of the quote
asset (the account-based asset).
@chappjc chappjc added this to the 0.6.1 milestone Apr 18, 2023
@buck54321
Copy link
Member

Was able to repro and confirm that this is resolves the issue.

@chappjc chappjc merged commit c46c9e5 into decred:master Apr 19, 2023
5 checks passed
@chappjc chappjc deleted the market-balancer-startup branch April 19, 2023 02:49
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.

None yet

2 participants