Our application is using a Bisq daemon (v1.9.12) via gRPC for trading. All works well but in one case we encountered a (severe) issue: When selling BTC for EUR (by taking an offer), a trade was (prematurely) closed after a payment confirmation was sent.
Using the desktop GUI we can see the trade now in the history list, but it has state “N/A” and the log file shows the following failures:
Aug-07 16:39:33.374 [JavaFX Application Thread] WARN bisq.core.trade.TradeManager: We found a closed trade with locked up funds. That should never happen. trade ID=09241-66bd2044-6f6f-4677-a228-9fa900e4c72e-1912
Aug-07 16:50:57.475 [JavaFX Application Thread] ERROR b.c.t.ClosedTradableFormatter: That must not happen. We got a pending state but we are in the closed trades list. state=SELLER_CONFIRMED_IN_UI_FIAT_PAYMENT_RECEIPT
(1) Does this effect the trading peer? Will the trade successfully complete on the other side?
(2) Is there a way to “unclose” the trade?
(3) Why does the CloseTrade RPC call fails to see the pending state?
Any help is appreciated.
This looks like the old “payout address reuse” bug, which just happened from the API.
Bisq will check for the payout on an address that was used for an older, completed trade, and which obviously already received the payout, so it thinks the trade completed. This happens right after clicking the “payment sent” button.
It is annoying and confusing, but if the payment arrived normally, and the seller is responsive, he will click the payment received button and you will see the outstanding balance of the trade in your bisq wallet.
If whatever is wrong, the seller will open mediation, and at that point you will be able to coordinate with a mediator a manual payout.
Maybe search for the mediator assigned to that trade and send him a private message on bisq.chat to tell them wha happened and relay the trade id, so they know to contact you if mediation is opened.
I can see that the payout transaction for the trade is now confirmed (took a while), so I guess the transaction went through for the other side too. This seems to solve issue (1).
Even if it looks like the trade completed successfully in a technical sense, the trade in the history list is still broken and I still get the warn/error messages in the log file. Any way to fix issue (2)?
Regarding issue (3): I think it is a good idea to check the trade phase/status at the beginning of the CloseTrade() call and to return an error if the trade is in an “uncloseable” state to prevent mistakes like this. Or is there any good reason to close a trade that is still in progress?
history database is now finalized on the currently saved situation, you can’t edit it even if I understand it’s reporting a wrong state.
For your last question, this being an edge case where bisq thinks the trade completed normally, it closes the trade exactly because of that. This issue had been addressed in a previous PR if I remember correctly but I still see it happening from time to time
We investigated a bit further and think it was a problem in the process flow on our side that explicitly called CloseTrade() prematurely - not a bug in Bisq.
The trade was technically completed; it showing something else in the history is annoying, but so be it.
EDIT: So I think the question “why does an explicit call to CloseTrade() cancels a pending trade” is somewhat still valid; it closes a trade before it reached phase “PAYOUT_PUBLISHED”. Maybe it is sufficient to add a comment about this in the API docs for CloseTrade() so others are at least warned. (We changed our logic to close a trade only after a payout transaction is confirmed in the blockchain). >Y<