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

<p>I left some initial comments.</p><hr>

<p>In <a href="https://github.com/bisq-network/bisq-core/pull/158#discussion_r211229289">src/main/java/bisq/core/btc/wallet/BsqWalletService.java</a>:</p>
<pre style='color:#555'>> @@ -634,6 +634,9 @@ public Transaction getPreparedUnlockTx(TxOutput lockedTxOutput) throws AddressFo
     }
 
     public Address getUnusedAddress() {
-        return wallet.freshReceiveAddress();
+        return wallet.getIssuedReceiveAddresses().stream()
+                .filter(address -> getNumTxOutputsForAddress(address) == 0)
</pre>
<p>Based on our conversation, I understand that before the commit <a class="commit-link" href="https://github.com/bisq-network/bisq-core/commit/4aaad1f86dba12a03eac600ef4ac1e116f0edb80"><tt>4aaad1f</tt></a>, the <code>getUnusedAddress()</code> method  generated a fresh set of addresses on each call, whereas it after the commit only generates fresh addresses if necessary.</p>
<p>(Optional) I feel like the commit ideally should mention this (currently it says only <code>Fix getUnusedAddress method</code>), and that ideally there should be some tests that cover the behavior before and after the change.</p>
<p>Apart from that, I think that the filtering on <code>getNumTxOutputsForAddress(address) == 0</code> predicate could be more clear in its semantics if e.g a method for <code>Address</code> like <code>.hasBeenUsed()</code> returned <code>true</code> if there were any tx outputs for that <code>Address</code>. Alternatively, we could document the semantics of what we're doing with a comment here.</p>
<p><em>Edit:</em> Ah, I see now that <code>Address</code> is a bitcoinj class, and it doesn't know about the tx outputs.. adding a utility method in <code>BsqWalletService</code> is probably best.</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-core/pull/158#pullrequestreview-147604269">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AkpZtv3kj_bKyqmGWUy3hj1sbVY9Q2GMks5uSqCMgaJpZM4WATGe">mute the thread</a>.<img src="https://github.com/notifications/beacon/AkpZtvdEaG8tKZgc9bcAHK669g4Zpjpdks5uSqCMgaJpZM4WATGe.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/bisq-network/bisq-core","title":"bisq-network/bisq-core","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/bisq-network/bisq-core"}},"updates":{"snippets":[{"icon":"PERSON","message":"@chirhonul commented on #158"}],"action":{"name":"View Pull Request","url":"https://github.com/bisq-network/bisq-core/pull/158#pullrequestreview-147604269"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq-core/pull/158#pullrequestreview-147604269",
"url": "https://github.com/bisq-network/bisq-core/pull/158#pullrequestreview-147604269",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
},
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"hideOriginalBody": "false",
"originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB",
"title": "@chirhonul commented on 158",
"sections": [
{
"text": "I left some initial comments.",
"activityTitle": "**chirhonul**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@chirhonul",
"facts": [

]
}
],
"potentialAction": [
{
"targets": [
{
"os": "default",
"uri": "https://github.com/bisq-network/bisq-core/pull/158#pullrequestreview-147604269"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 369176990\n}"
}
],
"themeColor": "26292E"
}
]</script>