fix contract mismatch taking sepa offer with sepa instant account #981

This commit is contained in:
woodser 2024-06-03 07:45:08 -04:00
parent 0919d92ce4
commit b963fd501f
4 changed files with 10 additions and 6 deletions

View file

@ -263,7 +263,13 @@ public final class Contract implements NetworkPayload {
// edits a contract json string // edits a contract json string
public static String sanitizeContractAsJson(String contractAsJson) { public static String sanitizeContractAsJson(String contractAsJson) {
return contractAsJson; // TODO: anything to sanitize? return contractAsJson
.replaceAll(
"\"takerPaymentAccountPayload\": \\{[^}]*}",
"\"takerPaymentAccountPayload\": null")
.replaceAll(
"\"makerPaymentAccountPayload\": \\{[^}]*}",
"\"makerPaymentAccountPayload\": null");
} }
public void printDiff(@Nullable String peersContractAsJson) { public void printDiff(@Nullable String peersContractAsJson) {

View file

@ -888,13 +888,13 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
P2PService.getMyNodeAddress(), P2PService.getMyNodeAddress(),
null); null);
} }
trade.getProcessModel().setUseSavingsWallet(useSavingsWallet); trade.getProcessModel().setUseSavingsWallet(useSavingsWallet);
trade.getProcessModel().setFundsNeededForTrade(fundsNeededForTrade.longValueExact()); trade.getProcessModel().setFundsNeededForTrade(fundsNeededForTrade.longValueExact());
trade.getMaker().setPaymentAccountId(offer.getOfferPayload().getMakerPaymentAccountId()); trade.getMaker().setPaymentAccountId(offer.getOfferPayload().getMakerPaymentAccountId());
trade.getMaker().setPubKeyRing(offer.getPubKeyRing()); trade.getMaker().setPubKeyRing(offer.getPubKeyRing());
trade.getSelf().setPubKeyRing(keyRing.getPubKeyRing()); trade.getSelf().setPubKeyRing(keyRing.getPubKeyRing());
trade.getSelf().setPaymentAccountId(paymentAccountId); trade.getSelf().setPaymentAccountId(paymentAccountId);
trade.getSelf().setPaymentMethodId(user.getPaymentAccount(paymentAccountId).getPaymentAccountPayload().getPaymentMethodId());
// initialize trade protocol // initialize trade protocol
TradeProtocol tradeProtocol = createTradeProtocol(trade); TradeProtocol tradeProtocol = createTradeProtocol(trade);

View file

@ -57,7 +57,7 @@ public class TakerSendInitTradeRequestToArbitrator extends TradeTask {
offer.getId(), offer.getId(),
trade.getAmount().longValueExact(), trade.getAmount().longValueExact(),
trade.getPrice().getValue(), trade.getPrice().getValue(),
offer.getOfferPayload().getPaymentMethodId(), trade.getSelf().getPaymentMethodId(),
trade.getMaker().getAccountId(), trade.getMaker().getAccountId(),
trade.getTaker().getAccountId(), trade.getTaker().getAccountId(),
trade.getMaker().getPaymentAccountId(), trade.getMaker().getPaymentAccountId(),

View file

@ -54,8 +54,6 @@ public class TakerSendInitTradeRequestToMaker extends TradeTask {
User user = processModel.getUser(); User user = processModel.getUser();
P2PService p2PService = processModel.getP2PService(); P2PService p2PService = processModel.getP2PService();
XmrWalletService walletService = model.getXmrWalletService(); XmrWalletService walletService = model.getXmrWalletService();
String paymentAccountId = trade.getSelf().getPaymentAccountId();
String paymentMethodId = user.getPaymentAccount(paymentAccountId).getPaymentAccountPayload().getPaymentMethodId();
String payoutAddress = walletService.getOrCreateAddressEntry(offer.getId(), XmrAddressEntry.Context.TRADE_PAYOUT).getAddressString(); String payoutAddress = walletService.getOrCreateAddressEntry(offer.getId(), XmrAddressEntry.Context.TRADE_PAYOUT).getAddressString();
// taker signs offer using offer id as nonce to avoid challenge protocol // taker signs offer using offer id as nonce to avoid challenge protocol
@ -67,7 +65,7 @@ public class TakerSendInitTradeRequestToMaker extends TradeTask {
offer.getId(), offer.getId(),
trade.getAmount().longValueExact(), trade.getAmount().longValueExact(),
trade.getPrice().getValue(), trade.getPrice().getValue(),
paymentMethodId, trade.getSelf().getPaymentMethodId(),
null, null,
user.getAccountId(), user.getAccountId(),
trade.getMaker().getPaymentAccountId(), trade.getMaker().getPaymentAccountId(),