mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Fix bug that sellers are restricted as well
Only buyers should be restricted if their account age is too young.
This commit is contained in:
parent
3b18d78781
commit
28727ad56d
3 changed files with 20 additions and 16 deletions
|
@ -44,18 +44,22 @@ public class PaymentAccountUtil {
|
|||
AccountAgeRestrictions.isMakersAccountAgeImmature(accountAgeWitnessService, offer);
|
||||
}
|
||||
|
||||
public static boolean isSellOfferAndAnyTakerPaymentAccountForOfferMature(Offer offer,
|
||||
Collection<PaymentAccount> takerPaymentAccounts,
|
||||
AccountAgeWitnessService accountAgeWitnessService) {
|
||||
public static boolean isSellOfferAndAllTakerPaymentAccountsForOfferImmature(Offer offer,
|
||||
Collection<PaymentAccount> takerPaymentAccounts,
|
||||
AccountAgeWitnessService accountAgeWitnessService) {
|
||||
if (offer.isBuyOffer()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!OfferRestrictions.isSellOfferRisky(offer)) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (PaymentAccount takerPaymentAccount : takerPaymentAccounts) {
|
||||
if (isTakerAccountForOfferMature(offer, takerPaymentAccount, accountAgeWitnessService))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean isTakerAccountForOfferMature(Offer offer,
|
||||
|
@ -96,7 +100,7 @@ public class PaymentAccountUtil {
|
|||
ObservableList<PaymentAccount> result = FXCollections.observableArrayList();
|
||||
result.addAll(paymentAccounts.stream()
|
||||
.filter(paymentAccount -> isTakerPaymentAccountValidForOffer(offer, paymentAccount))
|
||||
.filter(paymentAccount -> isTakerAccountForOfferMature(offer, paymentAccount, accountAgeWitnessService))
|
||||
.filter(paymentAccount -> offer.isBuyOffer() || isTakerAccountForOfferMature(offer, paymentAccount, accountAgeWitnessService))
|
||||
.collect(Collectors.toList()));
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -436,7 +436,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||
private void onShowInfo(Offer offer,
|
||||
boolean isPaymentAccountValidForOffer,
|
||||
boolean isRiskyBuyOfferWithImmatureAccountAge,
|
||||
boolean isSellOfferAndAnyTakerPaymentAccountForOfferMature,
|
||||
boolean isSellOfferAndAllTakerPaymentAccountsForOfferImmature,
|
||||
boolean hasSameProtocolVersion,
|
||||
boolean isIgnored,
|
||||
boolean isOfferBanned,
|
||||
|
@ -453,7 +453,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||
} else if (isRiskyBuyOfferWithImmatureAccountAge) {
|
||||
new Popup<>().warning(Res.get("offerbook.warning.riskyBuyOfferWithImmatureAccountAge",
|
||||
Res.get("offerbook.warning.newVersionAnnouncement"))).show();
|
||||
} else if (!isSellOfferAndAnyTakerPaymentAccountForOfferMature) {
|
||||
} else if (isSellOfferAndAllTakerPaymentAccountsForOfferImmature) {
|
||||
new Popup<>().warning(Res.get("offerbook.warning.sellOfferAndAnyTakerPaymentAccountForOfferMature",
|
||||
Res.get("offerbook.warning.newVersionAnnouncement"))).show();
|
||||
} else if (!hasSameProtocolVersion) {
|
||||
|
@ -821,7 +821,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||
final ImageView iconView = new ImageView();
|
||||
final AutoTooltipButton button = new AutoTooltipButton();
|
||||
boolean isTradable, isPaymentAccountValidForOffer, isRiskyBuyOfferWithImmatureAccountAge,
|
||||
isSellOfferAndAnyTakerPaymentAccountForOfferMature,
|
||||
isSellOfferAndAllTakerPaymentAccountsForOfferImmature,
|
||||
hasSameProtocolVersion, isIgnored, isOfferBanned, isCurrencyBanned,
|
||||
isPaymentMethodBanned, isNodeAddressBanned, isInsufficientTradeLimit,
|
||||
requireUpdateToNewVersion;
|
||||
|
@ -844,7 +844,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||
if (tableRow != null) {
|
||||
isPaymentAccountValidForOffer = model.isAnyPaymentAccountValidForOffer(offer);
|
||||
isRiskyBuyOfferWithImmatureAccountAge = model.isRiskyBuyOfferWithImmatureAccountAge(offer);
|
||||
isSellOfferAndAnyTakerPaymentAccountForOfferMature = model.isSellOfferAndAnyTakerPaymentAccountForOfferMature(offer);
|
||||
isSellOfferAndAllTakerPaymentAccountsForOfferImmature = model.isSellOfferAndAllTakerPaymentAccountsForOfferImmature(offer);
|
||||
hasSameProtocolVersion = model.hasSameProtocolVersion(offer);
|
||||
isIgnored = model.isIgnored(offer);
|
||||
isOfferBanned = model.isOfferBanned(offer);
|
||||
|
@ -855,7 +855,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||
isInsufficientTradeLimit = model.isInsufficientTradeLimit(offer);
|
||||
isTradable = isPaymentAccountValidForOffer &&
|
||||
!isRiskyBuyOfferWithImmatureAccountAge &&
|
||||
isSellOfferAndAnyTakerPaymentAccountForOfferMature &&
|
||||
!isSellOfferAndAllTakerPaymentAccountsForOfferImmature &&
|
||||
hasSameProtocolVersion &&
|
||||
!isIgnored &&
|
||||
!isOfferBanned &&
|
||||
|
@ -879,7 +879,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||
onShowInfo(offer,
|
||||
isPaymentAccountValidForOffer,
|
||||
isRiskyBuyOfferWithImmatureAccountAge,
|
||||
isSellOfferAndAnyTakerPaymentAccountForOfferMature,
|
||||
isSellOfferAndAllTakerPaymentAccountsForOfferImmature,
|
||||
hasSameProtocolVersion,
|
||||
isIgnored,
|
||||
isOfferBanned,
|
||||
|
@ -921,7 +921,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||
button.setOnAction(e -> onShowInfo(offer,
|
||||
isPaymentAccountValidForOffer,
|
||||
isRiskyBuyOfferWithImmatureAccountAge,
|
||||
isSellOfferAndAnyTakerPaymentAccountForOfferMature,
|
||||
isSellOfferAndAllTakerPaymentAccountsForOfferImmature,
|
||||
hasSameProtocolVersion,
|
||||
isIgnored,
|
||||
isOfferBanned,
|
||||
|
|
|
@ -509,9 +509,9 @@ class OfferBookViewModel extends ActivatableViewModel {
|
|||
PaymentAccountUtil.isAnyTakerPaymentAccountValidForOffer(offer, user.getPaymentAccounts());
|
||||
}
|
||||
|
||||
boolean isSellOfferAndAnyTakerPaymentAccountForOfferMature(Offer offer) {
|
||||
boolean isSellOfferAndAllTakerPaymentAccountsForOfferImmature(Offer offer) {
|
||||
return user.getPaymentAccounts() != null &&
|
||||
PaymentAccountUtil.isSellOfferAndAnyTakerPaymentAccountForOfferMature(offer, user.getPaymentAccounts(), accountAgeWitnessService);
|
||||
PaymentAccountUtil.isSellOfferAndAllTakerPaymentAccountsForOfferImmature(offer, user.getPaymentAccounts(), accountAgeWitnessService);
|
||||
}
|
||||
|
||||
boolean isRiskyBuyOfferWithImmatureAccountAge(Offer offer) {
|
||||
|
|
Loading…
Add table
Reference in a new issue