[bisq-network/bisq] Add local Bitcoin node configuration detection (#3982)

dmos62 notifications at github.com
Mon Feb 17 22:56:58 UTC 2020


Refactors LocalBitcoinNode and adds detection for local Bitcoin node's
configuration, namely, whether it is pruning and whether it has bloom
filter queries enabled.

The local node's configuration (and its presence) is retrieved by
performing a Bitcoin protocol handshake, which includes the local
Bitcoin node sending us its version message (VersionMessage in
BitcoinJ), which contains the information we're interested in.

Due to some quirky BitcoinJ logic, sometimes the handshake is
interrupted, even though we have received the local node's version
message. That contributes to the handshake handling in LocalBitcoinNode
being a bit complicated.

Refactoring consists of two principle changes: the public interface is
split into methods that trigger checks and methods that retrieve the
cached results. The methods that trigger checks have names starting
with "check", and methods that retrieve the cached results have names
that start with "is".

The other major refactor is the use of Optional<Boolean> instead of
boolean for storing and returning the results, an empty Optional
signifying that the relevant check was not yet performed. Switching to
Optionals has caused other code that queries LocalBitcoinNode to throw
an exception in case the query is made before the checks are. Before,
the results were instantiated to "false" and that would be returned
in case the query was made before the checks completed. This change has
revealed one occasion (Preferences class) where this happens.

This is shown in case a local Bitcoin node is found running, but misconfigured:
![local node misconfigured popup](https://user-images.githubusercontent.com/2715476/74690344-6579d580-51e7-11ea-82ae-c16dc9e504af.png)

This is shown when setup with a local Bitcoin node is completed, to remind the user to have the node fully synced before using Bisq, and what the other requirements are: 
![local node info popup](https://user-images.githubusercontent.com/2715476/74690341-6448a880-51e7-11ea-9c1e-fedbd188cfa6.png)

I hope to receive some phrasing corrections and maybe some UI ideas? I'm not totally happy with the "information" popup above: it's a bit redundant.

Possible next steps: 
- tell the user what exactly is misconfigured;
- option to retry the check.

I could have spent a bit more time and implemented these features too, but it's already two weeks that I'm doing this, so I'm just thrilled that I have something to PR. I can work on these later; I'll let you decide if these features are worthwhile.

Relevant issue: #3273
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Add local Bitcoin node configuration detection

-- File Changes --

    M core/src/main/java/bisq/core/app/BisqSetup.java (31)
    M core/src/main/java/bisq/core/btc/nodes/LocalBitcoinNode.java (297)
    M core/src/main/java/bisq/core/btc/setup/WalletConfig.java (7)
    M core/src/main/java/bisq/core/btc/setup/WalletsSetup.java (2)
    M core/src/main/java/bisq/core/user/Preferences.java (17)
    M core/src/main/resources/i18n/displayStrings.properties (8)
    M desktop/src/main/java/bisq/desktop/main/MainViewModel.java (18)
    M desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.java (6)

-- Patch Links --

https://github.com/bisq-network/bisq/pull/3982.patch
https://github.com/bisq-network/bisq/pull/3982.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/3982
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20200217/582016f6/attachment.html>


More information about the bisq-github mailing list