[bisq-network/bisq] Adjust API 'editoffer' to PR 5651 (include extraData field when editing offer) (#5666)

Stan notifications at github.com
Fri Aug 20 19:42:18 CEST 2021

@ghubstan commented on this pull request.

> +        if (!candidateWithMatchingPayloadHash.isPresent()) {
+            if (log.isDebugEnabled()) {
+                log.debug("UI view list does not contain offer with id {} and payload-hash {}",
+                        offer.getId(),
+                        hashOfPayload == null ? "null" : hashOfPayload.getHex());
+            }
+            return;
+        }
+        OfferBookListItem candidate = candidateWithMatchingPayloadHash.get();
+        // Remove the candidate only if the candidate's offer payload hash matches the
+        // onRemoved hashOfPayload parameter.  We may receive add/remove messages out of
+        // order (from api's 'editoffer'), and use the offer payload hash to
+        // ensure we do not remove an edited offer immediately after it was added.
+        if ((candidate.getHashOfPayload() == null || candidate.getHashOfPayload().equals(hashOfPayload))) {

There can be a null hash each time a user clicks on the view, and calling `OfferBook#fillOfferBookListItems()`.  That method loads the view using `offerBookService.getOffers()`, and the returned list elements are mapped to new `OfferBookListItem(offer)`s with a null hash code.

We discussed this on keybase, when you mentioned the idea of adding a `transient var hash` to OfferPayload.
At that time, I also mentioned that without the cached OfferPayload hash,  OfferBook line 208 might be 
        `.map(o -> new OfferBookListItem(o, get32ByteHashAsByteArray(o.getOfferPayload()))`

There is a comment about null hashes in `OfferBookListItem`:  _A null value indicates the item's payload hash has not been set by onAdded or onRemoved since the most recent OfferBook view refresh._

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20210820/d6ff8a22/attachment.htm>

More information about the bisq-github mailing list