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
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) {

View file

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

View file

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

View file

@ -54,8 +54,6 @@ public class TakerSendInitTradeRequestToMaker extends TradeTask {
User user = processModel.getUser();
P2PService p2PService = processModel.getP2PService();
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();
// taker signs offer using offer id as nonce to avoid challenge protocol
@ -67,7 +65,7 @@ public class TakerSendInitTradeRequestToMaker extends TradeTask {
offer.getId(),
trade.getAmount().longValueExact(),
trade.getPrice().getValue(),
paymentMethodId,
trade.getSelf().getPaymentMethodId(),
null,
user.getAccountId(),
trade.getMaker().getPaymentAccountId(),