<p>Refactors LocalBitcoinNode and adds detection for local Bitcoin node's<br>
configuration, namely, whether it is pruning and whether it has bloom<br>
filter queries enabled.</p>
<p>The local node's configuration (and its presence) is retrieved by<br>
performing a Bitcoin protocol handshake, which includes the local<br>
Bitcoin node sending us its version message (VersionMessage in<br>
BitcoinJ), which contains the information we're interested in.</p>
<p>Due to some quirky BitcoinJ logic, sometimes the handshake is<br>
interrupted, even though we have received the local node's version<br>
message. That contributes to the handshake handling in LocalBitcoinNode<br>
being a bit complicated.</p>
<p>Refactoring consists of two principle changes: the public interface is<br>
split into methods that trigger checks and methods that retrieve the<br>
cached results. The methods that trigger checks have names starting<br>
with "check", and methods that retrieve the cached results have names<br>
that start with "is".</p>
<p>The other major refactor is the use of Optional instead of<br>
boolean for storing and returning the results, an empty Optional<br>
signifying that the relevant check was not yet performed. Switching to<br>
Optionals has caused other code that queries LocalBitcoinNode to throw<br>
an exception in case the query is made before the checks are. Before,<br>
the results were instantiated to "false" and that would be returned<br>
in case the query was made before the checks completed. This change has<br>
revealed one occasion (Preferences class) where this happens.</p>
<p>This is shown in case a local Bitcoin node is found running, but misconfigured:<br>
<a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/2715476/74690344-6579d580-51e7-11ea-82ae-c16dc9e504af.png"><img src="https://user-images.githubusercontent.com/2715476/74690344-6579d580-51e7-11ea-82ae-c16dc9e504af.png" alt="local node misconfigured popup" style="max-width:100%;"></a></p>
<p>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:<br>
<a target="_blank" rel="noopener noreferrer" href="https://user-images.githubusercontent.com/2715476/74690341-6448a880-51e7-11ea-9c1e-fedbd188cfa6.png"><img src="https://user-images.githubusercontent.com/2715476/74690341-6448a880-51e7-11ea-9c1e-fedbd188cfa6.png" alt="local node info popup" style="max-width:100%;"></a></p>
<p>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.</p>
<p>Possible next steps:</p>
<ul>
<li>tell the user what exactly is misconfigured;</li>
<li>option to retry the check.</li>
</ul>
<p>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.</p>
<p>Relevant issue: <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="494134562" data-permission-text="Issue title is private" data-url="https://github.com/bisq-network/bisq/issues/3273" data-hovercard-type="issue" data-hovercard-url="/bisq-network/bisq/issues/3273/hovercard" href="https://github.com/bisq-network/bisq/issues/3273">#3273</a></p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/bisq-network/bisq/pull/3982'>https://github.com/bisq-network/bisq/pull/3982</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Add local Bitcoin node configuration detection</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3982/files#diff-0">core/src/main/java/bisq/core/app/BisqSetup.java</a>
    (31)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3982/files#diff-1">core/src/main/java/bisq/core/btc/nodes/LocalBitcoinNode.java</a>
    (297)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3982/files#diff-2">core/src/main/java/bisq/core/btc/setup/WalletConfig.java</a>
    (7)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3982/files#diff-3">core/src/main/java/bisq/core/btc/setup/WalletsSetup.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3982/files#diff-4">core/src/main/java/bisq/core/user/Preferences.java</a>
    (17)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3982/files#diff-5">core/src/main/resources/i18n/displayStrings.properties</a>
    (8)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3982/files#diff-6">desktop/src/main/java/bisq/desktop/main/MainViewModel.java</a>
    (18)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/3982/files#diff-7">desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.java</a>
    (6)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/bisq-network/bisq/pull/3982.patch'>https://github.com/bisq-network/bisq/pull/3982.patch</a></li>
  <li><a href='https://github.com/bisq-network/bisq/pull/3982.diff'>https://github.com/bisq-network/bisq/pull/3982.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bisq/pull/3982?email_source=notifications&email_token=AJFFTNW5OVAFHH455OTMXUDRDMI3VA5CNFSM4KWZVT6KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IOE4E4A">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNVW5G7BR3DIXPAKPD3RDMI3VANCNFSM4KWZVT6A">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNUUBLKUPVI2WBOM3LDRDMI3VA5CNFSM4KWZVT6KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IOE4E4A.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq/pull/3982?email_source=notifications\u0026email_token=AJFFTNW5OVAFHH455OTMXUDRDMI3VA5CNFSM4KWZVT6KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IOE4E4A",
"url": "https://github.com/bisq-network/bisq/pull/3982?email_source=notifications\u0026email_token=AJFFTNW5OVAFHH455OTMXUDRDMI3VA5CNFSM4KWZVT6KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IOE4E4A",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>