mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-11-16 15:58:08 +00:00
support invalid offer state
This commit is contained in:
parent
7887c450c7
commit
0ea056104c
6 changed files with 12 additions and 3 deletions
|
@ -81,7 +81,8 @@ public class Offer implements NetworkPayload, PersistablePayload {
|
|||
AVAILABLE,
|
||||
NOT_AVAILABLE,
|
||||
REMOVED,
|
||||
MAKER_OFFLINE
|
||||
MAKER_OFFLINE,
|
||||
INVALID
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -54,7 +54,7 @@ public class ProcessOfferAvailabilityResponse extends Task<OfferAvailabilityMode
|
|||
|
||||
// verify maker signature for trade request
|
||||
if (!HavenoUtils.isMakerSignatureValid(model.getTradeRequest(), offerAvailabilityResponse.getMakerSignature(), offer.getPubKeyRing())) {
|
||||
offer.setState(Offer.State.UNKNOWN); // TODO: using as invalid state
|
||||
offer.setState(Offer.State.INVALID);
|
||||
failed("Take offer attempt failed because maker signature is invalid");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -563,6 +563,7 @@ takeOffer.setAmountPrice=Set amount
|
|||
takeOffer.alreadyFunded.askCancel=You have already funded that offer.\nIf you cancel now, your funds will remain in your local Haveno wallet and are available for withdrawal in the \"Funds/Send funds\" screen.\nAre you sure you want to cancel?
|
||||
takeOffer.failed.offerNotAvailable=Take offer request failed because the offer is not available anymore. Maybe another trader has taken the offer in the meantime.
|
||||
takeOffer.failed.offerTaken=You cannot take that offer because the offer was already taken by another trader.
|
||||
takeOffer.failed.offerInvalid=You cannot take that offer because the maker's signature is invalid.
|
||||
takeOffer.failed.offerRemoved=You cannot take that offer because the offer has been removed in the meantime.
|
||||
takeOffer.failed.offererNotOnline=Take offer request failed because maker is not online anymore.
|
||||
takeOffer.failed.offererOffline=You cannot take that offer because the maker is offline.
|
||||
|
|
|
@ -149,7 +149,9 @@ class TakeOfferDataModel extends OfferDataModel {
|
|||
},
|
||||
errorMessage -> {
|
||||
log.warn(errorMessage);
|
||||
if (offer.getState() != Offer.State.NOT_AVAILABLE) new Popup().warning(errorMessage).show(); // expected and handled elsewhere in UI
|
||||
if (offer.getState() != Offer.State.NOT_AVAILABLE && offer.getState() != Offer.State.INVALID) { // handled elsewhere in UI
|
||||
new Popup().warning(errorMessage).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -373,6 +373,10 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
|||
offerWarning.set(Res.get("takeOffer.failed.offerTaken"));
|
||||
takeOfferRequested = false;
|
||||
break;
|
||||
case INVALID:
|
||||
offerWarning.set(Res.get("takeOffer.failed.offerInvalid"));
|
||||
takeOfferRequested = false;
|
||||
break;
|
||||
case REMOVED:
|
||||
// if (takeOfferRequested) // TODO: show any warning or removed is expected?
|
||||
// offerWarning.set(Res.get("takeOffer.failed.offerRemoved"));
|
||||
|
|
|
@ -1358,6 +1358,7 @@ message Offer {
|
|||
NOT_AVAILABLE = 4;
|
||||
REMOVED = 5;
|
||||
MAKER_OFFLINE = 6;
|
||||
INVALID = 7;
|
||||
}
|
||||
|
||||
OfferPayload offer_payload = 1;
|
||||
|
|
Loading…
Reference in a new issue