Fix issue with offers getting disabled for no apparent reason

This commit is contained in:
Android-X13 2022-09-01 20:01:04 +03:00
parent 854c6218b3
commit ee2db16451
No known key found for this signature in database
GPG Key ID: 161BE7DF6FC78FC7
2 changed files with 5 additions and 1 deletions

View File

@ -187,6 +187,10 @@ public final class OpenOffer implements Tradable {
return state == State.DEACTIVATED; return state == State.DEACTIVATED;
} }
public boolean isCanceled() {
return state == State.CANCELED;
}
public BsqSwapOfferPayload getBsqSwapOfferPayload() { public BsqSwapOfferPayload getBsqSwapOfferPayload() {
checkArgument(getOffer().getBsqSwapOfferPayload().isPresent(), checkArgument(getOffer().getBsqSwapOfferPayload().isPresent(),
"getBsqSwapOfferPayload must be called only when BsqSwapOfferPayload is the expected payload"); "getBsqSwapOfferPayload must be called only when BsqSwapOfferPayload is the expected payload");

View File

@ -202,7 +202,7 @@ public class TriggerPriceService {
String currencyCode = openOffer.getOffer().getCurrencyCode(); String currencyCode = openOffer.getOffer().getCurrencyCode();
if (openOffersByCurrency.containsKey(currencyCode)) { if (openOffersByCurrency.containsKey(currencyCode)) {
Set<OpenOffer> set = openOffersByCurrency.get(currencyCode); Set<OpenOffer> set = openOffersByCurrency.get(currencyCode);
set.remove(openOffer); set.removeIf(OpenOffer::isCanceled);
if (set.isEmpty()) { if (set.isEmpty()) {
openOffersByCurrency.remove(currencyCode); openOffersByCurrency.remove(currencyCode);
} }