Skip to content

Commit

Permalink
fix contract mismatch by nullifying extra info empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Jan 27, 2025
1 parent 6c6c6e2 commit 9b50cd7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/src/main/java/haveno/core/offer/CreateOfferService.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ public Offer createAndGetOffer(String offerId,
buyerAsTakerWithoutDeposit,
extraInfo);

// must nullify empty string so contracts match
if ("".equals(extraInfo)) extraInfo = null;

// verify buyer as taker security deposit
boolean isBuyerMaker = offerUtil.isBuyOffer(direction);
if (!isBuyerMaker && !isPrivateOffer && buyerAsTakerWithoutDeposit) {
Expand All @@ -142,14 +145,11 @@ public Offer createAndGetOffer(String offerId,
if (marketPriceMargin != 0) throw new IllegalArgumentException("Cannot set market price margin with fixed price");
}

long creationTime = new Date().getTime();
NodeAddress makerAddress = p2PService.getAddress();
// verify price
boolean useMarketBasedPriceValue = fixedPrice == null &&
useMarketBasedPrice &&
isMarketPriceAvailable(currencyCode) &&
!PaymentMethod.isFixedPriceOnly(paymentAccount.getPaymentMethod().getId());

// verify price
if (fixedPrice == null && !useMarketBasedPriceValue) {
throw new IllegalArgumentException("Must provide fixed price");
}
Expand All @@ -166,6 +166,8 @@ public Offer createAndGetOffer(String offerId,
challengeHash = HavenoUtils.getChallengeHash(challenge);
}

long creationTime = new Date().getTime();
NodeAddress makerAddress = p2PService.getAddress();
long priceAsLong = fixedPrice != null ? fixedPrice.getValue() : 0L;
double marketPriceMarginParam = useMarketBasedPriceValue ? marketPriceMargin : 0;
long amountAsLong = amount != null ? amount.longValueExact() : 0L;
Expand Down

0 comments on commit 9b50cd7

Please sign in to comment.