dcrdex
dcrdex copied to clipboard
core: funds are released with huge delay for failed-to-place trade
When Client is unable to place a trade due to Server rejecting it, for example:
2025-01-19 14:07:09.195 [ERR] CORE: notify: |ERROR| (order) In-Flight Order Error - In-Flight order with ID 3 failed: new order request with DEX server dex.decred.org:7232 market dcr_btc failed: rpc error: error code 36: failed funding validation
Client funds are locked and only released on the next wallet balance update (BTC wallet in this case) which might happen tens of minutes later (eg. upon next BTC block being mined, or upon Bison wallet restart).
Instead funds should be released immediately.
The following change seems to be resolving this issue: https://github.com/norwnd/bison-lean/commit/b985e49991989132c158bc515fb98b37e3bc5650
notes:
- it also should account for funds reserved for Redeems/Refunds
- there is also minor refactoring in there for
ErrorCloserto make the intentions around its usage explicit