<p><b>@chimp1984</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/bisq-network/bisq/pull/3773#discussion_r356772020">core/src/main/java/bisq/core/dao/DaoFacade.java</a>:</p>
<pre style='color:#555'>> @@ -624,7 +625,8 @@ public int getNumIssuanceTransactions(IssuanceType issuanceType) {
         return daoStateService.getUnspentTxOutputs();
     }
 
-    public Set<Tx> getTxs() {
+    // Returns a view rather than a copy of all the txs.
+    public Collection<Tx> getTxs() {
</pre>
<p>As the client only is interested in the number of txs, I think we should change that to a method only returning the size. This will further render the getTxs() method in daoStateService needless.</p>

<hr>

<p>In <a href="https://github.com/bisq-network/bisq/pull/3773#discussion_r356773051">core/src/main/java/bisq/core/dao/state/DaoStateService.java</a>:</p>
<pre style='color:#555'>>      }
 
-    public Set<Tx> getTxs() {
-        return new HashSet<>(getTxMap().values());
-    }
-
-    public Optional<Tx> getTx(String txId) {
-        return Optional.ofNullable(getTxMap().get(txId));
+    public Collection<Tx> getTxs() {
</pre>
<p>This method is only called by DaoFacade where the client is only interested in the size, so I would suggest to add a new <code>getNumTxs()</code> method instead and the other usage is the <code>getUnorderedTxStream()</code> method in the same class, which could use <code>daoState.getTxMap().values().stream()</code> directly. So we can remove the <code>getTxs()</code> completely.</p>

<hr>

<p>In <a href="https://github.com/bisq-network/bisq/pull/3773#discussion_r356778184">core/src/main/java/bisq/core/dao/state/DaoStateService.java</a>:</p>
<pre style='color:#555'>> @@ -115,6 +116,9 @@ public void applySnapshot(DaoState snapshot) {
 
         daoState.setChainHeight(snapshot.getChainHeight());
 
+        daoState.getTxMap().clear();
+        daoState.getTxMap().putAll(snapshot.getTxMap());
</pre>
<p>I fear that might not have much effect on performance as usually there are very few txs in a block. In average we have 1 tx in 2 blocks.</p>

<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/3773?email_source=notifications&email_token=AJFFTNUILCMAWGMZIEAMFL3QYE2O3A5CNFSM4JZCA3Q2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCO3QU5Y#pullrequestreview-330762871">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNTWPIYE4ZCFCTFFLFTQYE2O3ANCNFSM4JZCA3QQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNUWXEKVVBNLOFULVXLQYE2O3A5CNFSM4JZCA3Q2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCO3QU5Y.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/3773?email_source=notifications\u0026email_token=AJFFTNUILCMAWGMZIEAMFL3QYE2O3A5CNFSM4JZCA3Q2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCO3QU5Y#pullrequestreview-330762871",
"url": "https://github.com/bisq-network/bisq/pull/3773?email_source=notifications\u0026email_token=AJFFTNUILCMAWGMZIEAMFL3QYE2O3A5CNFSM4JZCA3Q2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCO3QU5Y#pullrequestreview-330762871",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>