<p></p>
<p><b>@dmos62</b> requested changes on this pull request.</p>

<hr>

<p>In <a href="https://github.com/bisq-network/bisq/pull/4299#discussion_r440798144">core/src/main/java/bisq/core/grpc/CoreWalletsService.java</a>:</p>
<pre style='color:#555'>> +
+        // Iterate the list of Tuple3<AddressString, Balance, NumConfirmations> objects
+        // and build the formatted info string.
+        StringBuilder addressInfoBuilder = new StringBuilder();
+        addrBalanceConfirms.forEach(a -> {
+            var btcBalance = formatSatoshis.apply(a.second);
+            var numConfirmations = getNumConfirmationsForMostRecentTransaction(a.first);
+            String addressInfo = "" + a.first
+                    + "  balance: " + format("%13s", btcBalance)
+                    + ((a.second > 0) ? ("  confirmations: " + format("%6d", numConfirmations)) : "")
+                    + "\n";
+            addressInfoBuilder.append(addressInfo);
+        });
+
+        return addressInfoBuilder.toString().trim();
+    }
</pre>
<p>The Tuple3 feels unnecessary. Its main use seems to be to cache the balances, which are needed for checking if we need to generate a new address, otherwise we could get all that while formatting and a structure to hold these intermediary results wouldn't be necessary. Since the problem is basically caching, we can just do that explicitly by memoizing <code>getAddressBalance</code>:</p>
<pre><code>var balances = CacheLoader.from(getAddressBalance);
// Usage:
var someBalance = balances.load(someAddress);
</code></pre>
<p><a href="https://guava.dev/releases/20.0/api/docs/com/google/common/cache/CacheLoader.html" rel="nofollow">https://guava.dev/releases/20.0/api/docs/com/google/common/cache/CacheLoader.html</a></p>
<p>That will make the rest of the method simpler and shorter.</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/4299#pullrequestreview-431434133">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNVIOOXL4DP2WJLWBITRW6ATZANCNFSM4N5F3SAQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNRM2ELISOQKJ5EJC43RW6ATZA5CNFSM4N5F3SA2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGODG3STFI.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/4299#pullrequestreview-431434133",
"url": "https://github.com/bisq-network/bisq/pull/4299#pullrequestreview-431434133",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>