<p></p>
<p><b>@sqrrm</b> commented on this pull request.</p>
<hr>
<p>In <a href="https://github.com/bisq-network/bisq/pull/5659#discussion_r687839333">desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBook.java</a>:</p>
<pre style='color:#555'>> if (!hasSameOffer) {
- OfferBookListItem offerBookListItem = new OfferBookListItem(offer);
- // We don't use the contains method as the equals method in Offer takes state and errorMessage into account.
- // If we have an offer with same ID we remove it and add the new offer as it might have a changed state.
- Optional<OfferBookListItem> candidateWithSameId = offerBookListItems.stream()
- .filter(item -> item.getOffer().getId().equals(offer.getId()))
- .findAny();
- if (candidateWithSameId.isPresent()) {
- log.warn("We had an old offer in the list with the same Offer ID. We remove the old one. " +
- "old offerBookListItem={}, new offerBookListItem={}", candidateWithSameId.get(), offerBookListItem);
- offerBookListItems.remove(candidateWithSameId.get());
+ OfferBookListItem newOfferBookListItem = new OfferBookListItem(offer, hashOfPayload, sequenceNumber);
+ removeAnyOldOfferBookListItemsBeforeAddingReplacement(newOfferBookListItem);
</pre>
<p>I find this method name somewhat on the long side</p>
<hr>
<p>In <a href="https://github.com/bisq-network/bisq/pull/5659#discussion_r687851669">desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookListItem.java</a>:</p>
<pre style='color:#555'>> @@ -79,7 +110,7 @@ public WitnessAgeData getWitnessAgeData(AccountAgeWitnessService accountAgeWitne
// either signed & limits lifted, or waiting for limits to be lifted
// Or banned
daysSinceSignedAsLong = TimeUnit.MILLISECONDS.toDays(optionalWitness.map(witness ->
- accountAgeWitnessService.getWitnessSignAge(witness, new Date()))
+ accountAgeWitnessService.getWitnessSignAge(witness, new Date()))
</pre>
<p>Bad indent</p>
<hr>
<p>In <a href="https://github.com/bisq-network/bisq/pull/5659#discussion_r689631147">desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBook.java</a>:</p>
<pre style='color:#555'>> + .filter(o -> !isOfferIdBanned(o))
+ .filter(o -> isV3NodeAddressCompliant(o))
</pre>
<p>If you use <code>ifOfferAllowed()</code> both of these filters can use method references instead. I find that's usually preferred when possible.</p>
<hr>
<p>In <a href="https://github.com/bisq-network/bisq/pull/5659#discussion_r689634240">desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBook.java</a>:</p>
<pre style='color:#555'>> offer.getId(),
- hashOfPayload.getHex());
+ hashOfPayload == null ? "null" : hashOfPayload.getHex());
+ }
+
+ // The OfferBookListItem with a null or matching payload-hash was not found.
+ // However, when the API's CLI is used to edit and deactivate an offer
+ // in the same command, the edited offer is not re-published (and cannot be
+ // found in local storage). In this case, we need to remove the deactivated
+ // offer from the list if the local store does not contain an offer with a
+ // matching offerId.
+ if (!isStoredLocally(offer)) {
+ Optional<OfferBookListItem> viewItem = getOfferBookListItem(offer);
+ viewItem.ifPresent((item) -> {
+ offerBookListItems.remove(item);
</pre>
<p>Why is this needed? Isn't this just to present it nicely to the UI and that's not a problem when running the cli?</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/5659#pullrequestreview-728768353">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNXJCRZ7W7QS4BB72NTT5EUQZANCNFSM5B6V23YQ">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email">Android</a>.<img src="https://github.com/notifications/beacon/AJFFTNREN7ARND5YMV66LETT5EUQZA5CNFSM5B6V23Y2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOFNYB6YI.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/5659#pullrequestreview-728768353",
"url": "https://github.com/bisq-network/bisq/pull/5659#pullrequestreview-728768353",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>