bisq/desktop
ghubstan 6e2400fb0f
Ensure UI OfferBook items are correctly added and removed
Using the API's CLI to edit offers can sometimes result in add/remove messages
being received on peers in the same batch of envolopes, and these messages
are sometimes passed to the UI in (1) add, (2) remove order.  This can result in
a newly edited offer being removed immediately after being added to the OfferBook
list. This change uses storage entry sequence number and storage entry payload
hash comparisons to avoid the problem.

- OfferBookListItem Added new constructor taking P2PDataStorage.ByteArray hashOfPayload,
  and int sequenceNumber params.  Added a new toString() method.

- OfferBook Added new checks on OfferBookListItem hashOfPayload and sequenceNumber while
  determining if offer candidates should be added or removed from the UI's OfferBook List.
  See OfferBook contructor's implementation of OfferBookChangedListener#onAdded and
  OfferBookChangedListener#onRemoved.  Added many comments explaining the add/remove rules,
  and plenty of debug statements to help trace the add/remove event process.

- OfferBookService#OfferBookChangedListener Added new P2PDataStorage.ByteArray hashOfPayload,
  and int sequenceNumber params to listener's onAdded and onRemoved method signatures.
  Added these two new paramater values to listener.onAdded and listener.onRemoved calls.

- TakeOfferDataModel Replaced unused, old tradeManager param in offerBook.removeOffer()
  with (null) P2PDataStorage.ByteArray hashOfPayload, and (-1) int sequenceNumber params.
  OfferBook will remove the candidate offer as before.

- MarketAlerts Adjusted onAdded() & onRemoved listener method signatures, even though
  new P2PDataStorage.ByteArray hashOfPayload, int sequenceNumber params are not used
  by the implementations.
2021-08-07 14:06:38 -03:00
..
package Revert to SNAPSHOT version 2021-07-23 14:02:37 +02:00
src Ensure UI OfferBook items are correctly added and removed 2021-08-07 14:06:38 -03:00