listen for published payout tx

fix "Swapping pending OFFER_FUNDING" warning
move payout tx from TradingPeer to Trade
This commit is contained in:
woodser 2022-10-01 09:51:16 -04:00
parent 5fbc41946e
commit dc9c04759f
30 changed files with 231 additions and 279 deletions

View file

@ -30,7 +30,6 @@ import bisq.core.trade.protocol.tasks.ApplyFilter;
import bisq.core.trade.protocol.tasks.BuyerPreparePaymentSentMessage;
import bisq.core.trade.protocol.tasks.BuyerProcessPaymentReceivedMessage;
import bisq.core.trade.protocol.tasks.BuyerSendPaymentSentMessage;
import bisq.core.trade.protocol.tasks.BuyerSetupPayoutTxListener;
import bisq.core.trade.protocol.tasks.MakerSetLockTime;
import bisq.core.trade.protocol.tasks.MakerRemoveOpenOffer;
import bisq.core.trade.protocol.tasks.SellerPreparePaymentReceivedMessage;
@ -38,6 +37,7 @@ import bisq.core.trade.protocol.tasks.SellerProcessPaymentSentMessage;
import bisq.core.trade.protocol.tasks.SellerPublishDepositTx;
import bisq.core.trade.protocol.tasks.SellerPublishTradeStatistics;
import bisq.core.trade.protocol.tasks.SellerSendPaymentReceivedMessage;
import bisq.core.trade.protocol.tasks.SetupPayoutTxListener;
import bisq.core.trade.protocol.tasks.TakerVerifyMakerFeePayment;
import bisq.core.trade.protocol.tasks.VerifyPeersAccountAgeWitness;
import bisq.common.taskrunner.Task;
@ -123,7 +123,7 @@ public class DebugView extends InitializableView<GridPane, Void> {
ApplyFilter.class,
BuyerPreparePaymentSentMessage.class,
BuyerSetupPayoutTxListener.class,
SetupPayoutTxListener.class,
BuyerSendPaymentSentMessage.class,
BuyerProcessPaymentReceivedMessage.class
@ -142,7 +142,7 @@ public class DebugView extends InitializableView<GridPane, Void> {
ApplyFilter.class,
TakerVerifyMakerFeePayment.class,
BuyerPreparePaymentSentMessage.class,
BuyerSetupPayoutTxListener.class,
SetupPayoutTxListener.class,
BuyerSendPaymentSentMessage.class,
BuyerProcessPaymentReceivedMessage.class)

View file

@ -200,7 +200,7 @@ public class TradeDetailsWindow extends Overlay<TradeDetailsWindow> {
trade.getAssetTxProofResult() != null &&
trade.getAssetTxProofResult() != AssetTxProofResult.UNDEFINED;
if (trade.getPayoutTx() != null)
if (trade.getPayoutTxId() != null)
rows++;
boolean showDisputedTx = arbitrationManager.findOwnDispute(trade.getId()).isPresent() &&
arbitrationManager.findOwnDispute(trade.getId()).get().getDisputePayoutTxId() != null;
@ -283,9 +283,9 @@ public class TradeDetailsWindow extends Overlay<TradeDetailsWindow> {
addLabelTxIdTextField(gridPane, ++rowIndex, Res.get("shared.depositTransactionId"), // TODO (woodser): separate UI labels for deposit tx ids
trade.getTakerDepositTx().getHash());
if (trade.getPayoutTx() != null)
if (trade.getPayoutTxId() != null)
addLabelTxIdTextField(gridPane, ++rowIndex, Res.get("shared.payoutTxId"),
trade.getPayoutTx().getHash());
trade.getPayoutTxId());
if (showDisputedTx)
addLabelTxIdTextField(gridPane, ++rowIndex, Res.get("tradeDetailsWindow.disputedPayoutTxId"),
arbitrationManager.findOwnDispute(trade.getId()).get().getDisputePayoutTxId());

View file

@ -91,7 +91,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import monero.daemon.model.MoneroTx;
import monero.wallet.MoneroWallet;
import monero.wallet.model.MoneroTxWallet;
public class PendingTradesDataModel extends ActivatableDataModel {
@Getter
@ -465,11 +464,10 @@ public class PendingTradesDataModel extends ActivatableDataModel {
byte[] payoutTxSerialized = null;
String payoutTxHashAsString = null;
MoneroTxWallet payoutTx = trade.getPayoutTx();
MoneroWallet multisigWallet = xmrWalletService.getMultisigWallet(trade.getId());
String updatedMultisigHex = multisigWallet.exportMultisigHex();
xmrWalletService.closeMultisigWallet(trade.getId()); // close multisig wallet
if (payoutTx != null) {
if (trade.getPayoutTxId() != null) {
// payoutTxSerialized = payoutTx.bitcoinSerialize(); // TODO (woodser): no need to pass serialized txs for xmr
// payoutTxHashAsString = payoutTx.getHashAsString();
}

View file

@ -420,7 +420,7 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
// deposit published
case ARBITRATOR_PUBLISHED_DEPOSIT_TXS:
case DEPOSIT_TXS_SEEN_IN_BLOCKCHAIN:
case DEPOSIT_TXS_SEEN_IN_NETWORK:
case DEPOSIT_TXS_CONFIRMED_IN_BLOCKCHAIN: // TODO: separate step to wait for first confirmation
buyerState.set(BuyerState.STEP1);
sellerState.set(SellerState.STEP1);
@ -472,7 +472,7 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
// buyer step 4
case BUYER_RECEIVED_PAYOUT_TX_PUBLISHED_MSG:
// Alternatively the maker could have seen the payout tx earlier before he received the PAYOUT_TX_PUBLISHED_MSG:
case BUYER_SAW_PAYOUT_TX_IN_NETWORK:
case PAYOUT_TX_SEEN_IN_NETWORK:
// Alternatively the buyer could fully sign and publish the payout tx
case BUYER_PUBLISHED_PAYOUT_TX:
buyerState.set(BuyerState.STEP4);

View file

@ -203,7 +203,7 @@ public class TradeStepInfo {
footerLabel.setVisible(false);
}
if (trade != null && trade.getPayoutTx() != null) {
if (trade != null && trade.getPayoutTxId() != null) {
button.setDisable(true);
}
}

View file

@ -653,7 +653,7 @@ public abstract class TradeStepView extends AnchorPane {
return;
}
if (trade.getPayoutTx() != null) {
if (trade.getPayoutTxId() != null) {
return;
}