[bisq-network/bisq] Fix calculation & display of Locked Funds (PR #5813)

jmacxx notifications at github.com
Mon Nov 8 04:51:09 CET 2021


Fixes #5703, #5574

### Scenario:

If for any reason the deposit transaction is rejected by bitcoin nodes, Bisq thinks those funds are locked in a trade.  Bisq does not receive any notification about rejected transactions -- once they are broadcast via BitcoinJ they are assumed to be valid even though this may not be the case.  This can happen when for example if the user's wallet is out of sync and the deposit transaction is attempting to use already spent funds.  The only indication that something is wrong is that the deposit transaction never confirms (and if they look it up on a blockchain explorer the txId will not be found).  At this point Bisq will erroneously show the deposit amount in "Locked Funds" on the main screen.

This can be fixed by considering funds to be locked once the deposit transaction is **confirmed** on the blockchain.

----

### Code change:

We change one line in the method `isFundsLockedIn()` replacing `isDepositPublished` with `isDepositConfirmed`.

https://github.com/bisq-network/bisq/blob/851bdcf9ff0133462aa6e4e742fe59989a2d0db1/core/src/main/java/bisq/core/trade/model/bisq_v1/Trade.java#L921

In order to determine the possible impacts of this, here is a usage analysis of the altered method 'isFundsLockedIn'.
It is used in the following 3 locations:

**Funds -> Locked Funds Tab:**
    TradeManager.java +769 method getTradesStreamWithFundsLockedIn
        -> LockedView.java +224
            -> updates the amounts shown in Funds -> Locked Funds (active trades only)

**Main Screen Locked Balance:**
    TradeManager.java +769 method getTradesStreamWithFundsLockedIn
    ClosedTradableManager.java +156 method getTradesStreamWithFundsLockedIn
    FailedTradesManager.java +117 method getTradesStreamWithFundsLockedIn
        -> Balances.java +123
            -> sets the locked balance amount shown at the top right of the main screen

**Locked Funds Popup:**
    ClosedTradableManager.java +156 method getTradesStreamWithFundsLockedIn
    FailedTradesManager.java +117 method getTradesStreamWithFundsLockedIn
        Each of the above are used in the following two use cases:
        -> TradeManager.java +772 method getSetOfFailedOrClosedTradeIdsFromLockedInFunds
            -> BisqSetup.java  method checkForLockedUpFunds pops up a user directed warning message "you have locked up funds from a failed trade"








You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * <a href="https://github.com/bisq-network/bisq/pull/5813/commits/cea4fb30a2c0a33df48d26d2ffbccbba52f0ee66">Fix calculation & display of Locked Funds</a>

-- File Changes --

    M core/src/main/java/bisq/core/trade/model/bisq_v1/Trade.java (4)

-- Patch Links --

https://github.com/bisq-network/bisq/pull/5813.patch
https://github.com/bisq-network/bisq/pull/5813.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/5813
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20211107/fa751e5e/attachment-0001.htm>


More information about the bisq-github mailing list