<p><span class="issue-keyword tooltipped tooltipped-se" aria-label="This pull request closes issue #5210.">Fixes</span> <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="812635012" data-permission-text="Title is private" data-url="https://github.com/bisq-network/bisq/issues/5210" data-hovercard-type="issue" data-hovercard-url="/bisq-network/bisq/issues/5210/hovercard" href="https://github.com/bisq-network/bisq/issues/5210">#5210</a></p>
<p>TradeManager must be inited before MailboxMessageService.  Fixes two NPE scenarios described in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="812635012" data-permission-text="Title is private" data-url="https://github.com/bisq-network/bisq/issues/5210" data-hovercard-type="issue" data-hovercard-url="/bisq-network/bisq/issues/5210/hovercard" href="https://github.com/bisq-network/bisq/issues/5210">#5210</a></p>
<h3>Scenario 1.  Start up with a Mailbox message queued for delivery to DisputeManager</h3>
<ul>
<li>This relates to the first call stack posted in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="812635012" data-permission-text="Title is private" data-url="https://github.com/bisq-network/bisq/issues/5210" data-hovercard-type="issue" data-hovercard-url="/bisq-network/bisq/issues/5210/hovercard" href="https://github.com/bisq-network/bisq/issues/5210">#5210</a>.</li>
<li>The mailbox message service is initialized and propagates the message synchronously up to DisputeManager</li>
<li>DisputeManager queries the Trade associated with the Dispute.</li>
<li>We get an NPE while attempting to access <code>Trade -> processModel -> provider</code> as the TradeManager has not yet been initialized via <code>initPersistedTrades</code>.</li>
<li>The solution is to bootstrap the MailboxMessageService last so that any messages it dispatches are received by initialized services.</li>
</ul>
<h3>Scenario 2.  Start up with a password protected wallet.</h3>
<ul>
<li>Same pre-conditions as before, + have password protection set on Bob's wallet.</li>
<li>After entering the password we get the <a href="https://github.com/bisq-network/bisq/issues/5210#issuecomment-783579294" data-hovercard-type="issue" data-hovercard-url="/bisq-network/bisq/issues/5210/hovercard">second NPE</a> described.</li>
<li>The call stack shows that the initialization route located at <code>DomainInitialisation::initDomainServices()</code> is used.  It needs to call <code>tradeManager.onAllServicesInitialized()</code> before <code>arbitrationManager / mediationManager / refundManager</code> are started.</li>
</ul>

<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/5219'>https://github.com/bisq-network/bisq/pull/5219</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Fix initialization ordering issue</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5219/files#diff-37c3b47b826f623fefe33260bc604f9fd907cc45d7a3c1d8d3f6f71de34f8c7f">core/src/main/java/bisq/core/app/DomainInitialisation.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5219/files#diff-c159620533c6a13a99158d534b441d96836d1535ce5bd6baf816b5a2fe126b25">p2p/src/main/java/bisq/network/p2p/P2PService.java</a>
    (9)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/bisq-network/bisq/pull/5219.patch'>https://github.com/bisq-network/bisq/pull/5219.patch</a></li>
  <li><a href='https://github.com/bisq-network/bisq/pull/5219.diff'>https://github.com/bisq-network/bisq/pull/5219.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/5219">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNU5X45LTTKNFPL3IZDTAMBU7ANCNFSM4YBSWI7Q">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNXH4XSUUQYLYCZBGULTAMBU7A5CNFSM4YBSWI72YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4MEE463A.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/5219",
"url": "https://github.com/bisq-network/bisq/pull/5219",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>