fix contract mismatch by nullifying extra info empty string

This commit is contained in:
woodser 2025-01-26 21:04:05 -05:00
parent 6c6c6e2dd5
commit 9b50cd7ba7

View File

@ -130,6 +130,9 @@ public class CreateOfferService {
buyerAsTakerWithoutDeposit, buyerAsTakerWithoutDeposit,
extraInfo); extraInfo);
// must nullify empty string so contracts match
if ("".equals(extraInfo)) extraInfo = null;
// verify buyer as taker security deposit // verify buyer as taker security deposit
boolean isBuyerMaker = offerUtil.isBuyOffer(direction); boolean isBuyerMaker = offerUtil.isBuyOffer(direction);
if (!isBuyerMaker && !isPrivateOffer && buyerAsTakerWithoutDeposit) { if (!isBuyerMaker && !isPrivateOffer && buyerAsTakerWithoutDeposit) {
@ -142,14 +145,11 @@ public class CreateOfferService {
if (marketPriceMargin != 0) throw new IllegalArgumentException("Cannot set market price margin with fixed price"); if (marketPriceMargin != 0) throw new IllegalArgumentException("Cannot set market price margin with fixed price");
} }
long creationTime = new Date().getTime(); // verify price
NodeAddress makerAddress = p2PService.getAddress();
boolean useMarketBasedPriceValue = fixedPrice == null && boolean useMarketBasedPriceValue = fixedPrice == null &&
useMarketBasedPrice && useMarketBasedPrice &&
isMarketPriceAvailable(currencyCode) && isMarketPriceAvailable(currencyCode) &&
!PaymentMethod.isFixedPriceOnly(paymentAccount.getPaymentMethod().getId()); !PaymentMethod.isFixedPriceOnly(paymentAccount.getPaymentMethod().getId());
// verify price
if (fixedPrice == null && !useMarketBasedPriceValue) { if (fixedPrice == null && !useMarketBasedPriceValue) {
throw new IllegalArgumentException("Must provide fixed price"); throw new IllegalArgumentException("Must provide fixed price");
} }
@ -166,6 +166,8 @@ public class CreateOfferService {
challengeHash = HavenoUtils.getChallengeHash(challenge); challengeHash = HavenoUtils.getChallengeHash(challenge);
} }
long creationTime = new Date().getTime();
NodeAddress makerAddress = p2PService.getAddress();
long priceAsLong = fixedPrice != null ? fixedPrice.getValue() : 0L; long priceAsLong = fixedPrice != null ? fixedPrice.getValue() : 0L;
double marketPriceMarginParam = useMarketBasedPriceValue ? marketPriceMargin : 0; double marketPriceMarginParam = useMarketBasedPriceValue ? marketPriceMargin : 0;
long amountAsLong = amount != null ? amount.longValueExact() : 0L; long amountAsLong = amount != null ? amount.longValueExact() : 0L;