[bisq-network/bisq] Fix race condition in BTC sent confirmation popup (#5333)

jmacxx notifications at github.com
Fri Mar 19 16:51:35 CET 2021


Fixes #5331, #5305 

There is a race condition with the BTC display of the sent confirmation popup.  The address field and senders amount were obtained from GUI input elements which are cleared after a transaction has been sent.  So the fields could be empty when the confirmation popup is shown after the wallet calls back with success.

Solution is to move a variable `sendersAmount` from class scope to method scope and make it final.  Likewise the `withdrawToAddress` must be defined in method scope so that the method does not access the GUI input field after it has been cleared.

The problem does not occur for displaying BSQ sent transactions, because the relevant parameters are already method-scoped and immutable.

---

**Testing**

The issue can be reproduced consistently if you introduce a delay of 1 second in the processing of the wallet OnSuccess callback.  

    // testing fix for #5331 [delay the async popup by 1 sec]
    UserThread.runAfter(() -> {
        new TxDetails(transaction.getTxId().toString(), withdrawToAddress, formatter.formatCoinWithCode(sendersAmount))
                .dontShowAgainId(key)
                .show();
    }, 1, TimeUnit.SECONDS);


It helps verify that the fix works correctly.  (The delay was for testing/verification only, not included in PR).
You can view, comment on, or merge this pull request online at:

  https://github.com/bisq-network/bisq/pull/5333

-- Commit Summary --

  * fix race condition in sent confirmation popup

-- File Changes --

    M desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java (17)

-- Patch Links --

https://github.com/bisq-network/bisq/pull/5333.patch
https://github.com/bisq-network/bisq/pull/5333.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/5333
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20210319/28453c02/attachment.htm>


More information about the bisq-github mailing list