mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-14 01:15:44 -04:00
cleanup trade states, consolidate protocol tasks, remove old tasks
This commit is contained in:
parent
3d43ae1f20
commit
333b7421f5
76 changed files with 114 additions and 3807 deletions
|
@ -26,45 +26,20 @@ import bisq.core.offer.availability.tasks.SendOfferAvailabilityRequest;
|
|||
import bisq.core.offer.placeoffer.tasks.AddToOfferBook;
|
||||
import bisq.core.offer.placeoffer.tasks.MakerReservesOfferFunds;
|
||||
import bisq.core.offer.placeoffer.tasks.ValidateOffer;
|
||||
import bisq.core.trade.protocol.TakerVerifyMakerFeePayment;
|
||||
import bisq.core.trade.protocol.tasks.ApplyFilter;
|
||||
import bisq.core.trade.protocol.tasks.BuyerPreparesPaymentSentMessage;
|
||||
import bisq.core.trade.protocol.tasks.BuyerProcessesPaymentReceivedMessage;
|
||||
import bisq.core.trade.protocol.tasks.BuyerSendsPaymentSentMessage;
|
||||
import bisq.core.trade.protocol.tasks.BuyerSetupPayoutTxListener;
|
||||
import bisq.core.trade.protocol.tasks.MakerSetsLockTime;
|
||||
import bisq.core.trade.protocol.tasks.MaybeRemoveOpenOffer;
|
||||
import bisq.core.trade.protocol.tasks.SellerPreparesPaymentReceivedMessage;
|
||||
import bisq.core.trade.protocol.tasks.SellerProcessesPaymentSentMessage;
|
||||
import bisq.core.trade.protocol.tasks.SellerPublishesDepositTx;
|
||||
import bisq.core.trade.protocol.tasks.SellerPublishesTradeStatistics;
|
||||
import bisq.core.trade.protocol.tasks.SellerSendsPaymentReceivedMessage;
|
||||
import bisq.core.trade.protocol.tasks.VerifyPeersAccountAgeWitness;
|
||||
import bisq.core.trade.protocol.tasks.buyer.BuyerPreparesPaymentSentMessage;
|
||||
import bisq.core.trade.protocol.tasks.buyer.BuyerProcessDelayedPayoutTxSignatureRequest;
|
||||
import bisq.core.trade.protocol.tasks.buyer.BuyerProcessDepositTxAndDelayedPayoutTxMessage;
|
||||
import bisq.core.trade.protocol.tasks.buyer.BuyerProcessesPaymentReceivedMessage;
|
||||
import bisq.core.trade.protocol.tasks.buyer.BuyerSendsPaymentSentMessage;
|
||||
import bisq.core.trade.protocol.tasks.buyer.BuyerSendsDelayedPayoutTxSignatureResponse;
|
||||
import bisq.core.trade.protocol.tasks.buyer.BuyerSetupPayoutTxListener;
|
||||
import bisq.core.trade.protocol.tasks.buyer.BuyerSignsDelayedPayoutTx;
|
||||
import bisq.core.trade.protocol.tasks.buyer.BuyerVerifiesFinalDelayedPayoutTx;
|
||||
import bisq.core.trade.protocol.tasks.buyer.BuyerVerifiesPreparedDelayedPayoutTx;
|
||||
import bisq.core.trade.protocol.tasks.buyer_as_maker.BuyerAsMakerCreatesAndSignsDepositTx;
|
||||
import bisq.core.trade.protocol.tasks.buyer_as_maker.BuyerAsMakerSendsInputsForDepositTxResponse;
|
||||
import bisq.core.trade.protocol.tasks.buyer_as_taker.BuyerAsTakerCreatesDepositTxInputs;
|
||||
import bisq.core.trade.protocol.tasks.buyer_as_taker.BuyerAsTakerSendsDepositTxMessage;
|
||||
import bisq.core.trade.protocol.tasks.buyer_as_taker.BuyerAsTakerSignsDepositTx;
|
||||
import bisq.core.trade.protocol.tasks.maker.MaybeRemoveOpenOffer;
|
||||
import bisq.core.trade.protocol.tasks.maker.MakerSetsLockTime;
|
||||
import bisq.core.trade.protocol.tasks.maker.MakerVerifyTakerFeePayment;
|
||||
import bisq.core.trade.protocol.tasks.seller.SellerCreatesDelayedPayoutTx;
|
||||
import bisq.core.trade.protocol.tasks.seller.SellerFinalizesDelayedPayoutTx;
|
||||
import bisq.core.trade.protocol.tasks.seller.SellerProcessesPaymentSentMessage;
|
||||
import bisq.core.trade.protocol.tasks.seller.SellerProcessDelayedPayoutTxSignatureResponse;
|
||||
import bisq.core.trade.protocol.tasks.seller.SellerPublishesDepositTx;
|
||||
import bisq.core.trade.protocol.tasks.seller.SellerPublishesTradeStatistics;
|
||||
import bisq.core.trade.protocol.tasks.seller.SellerSendDelayedPayoutTxSignatureRequest;
|
||||
import bisq.core.trade.protocol.tasks.seller.SellerSendsPaymentReceivedMessage;
|
||||
import bisq.core.trade.protocol.tasks.seller.SellerPreparesPaymentReceivedMessage;
|
||||
import bisq.core.trade.protocol.tasks.seller.SellerSignsDelayedPayoutTx;
|
||||
import bisq.core.trade.protocol.tasks.seller_as_maker.SellerAsMakerCreatesUnsignedDepositTx;
|
||||
import bisq.core.trade.protocol.tasks.seller_as_maker.SellerAsMakerFinalizesDepositTx;
|
||||
import bisq.core.trade.protocol.tasks.seller_as_maker.SellerAsMakerSendsInputsForDepositTxResponse;
|
||||
import bisq.core.trade.protocol.tasks.seller_as_taker.SellerAsTakerCreatesDepositTxInputs;
|
||||
import bisq.core.trade.protocol.tasks.seller_as_taker.SellerAsTakerSignsDepositTx;
|
||||
import bisq.core.trade.protocol.tasks.taker.TakerProcessesInputsForDepositTxResponse;
|
||||
import bisq.core.trade.protocol.tasks.taker.TakerPublishFeeTx;
|
||||
import bisq.core.trade.protocol.tasks.taker.TakerVerifyMakerFeePayment;
|
||||
|
||||
import bisq.common.taskrunner.Task;
|
||||
import bisq.common.util.Tuple2;
|
||||
|
||||
|
@ -118,19 +93,10 @@ public class DebugView extends InitializableView<GridPane, Void> {
|
|||
FXCollections.observableArrayList(Arrays.asList(
|
||||
ApplyFilter.class,
|
||||
TakerVerifyMakerFeePayment.class,
|
||||
SellerAsTakerCreatesDepositTxInputs.class,
|
||||
|
||||
TakerProcessesInputsForDepositTxResponse.class,
|
||||
ApplyFilter.class,
|
||||
VerifyPeersAccountAgeWitness.class,
|
||||
TakerPublishFeeTx.class,
|
||||
SellerAsTakerSignsDepositTx.class,
|
||||
SellerCreatesDelayedPayoutTx.class,
|
||||
SellerSendDelayedPayoutTxSignatureRequest.class,
|
||||
|
||||
SellerProcessDelayedPayoutTxSignatureResponse.class,
|
||||
SellerSignsDelayedPayoutTx.class,
|
||||
SellerFinalizesDelayedPayoutTx.class,
|
||||
//SellerSendsDepositTxAndDelayedPayoutTxMessage.class,
|
||||
SellerPublishesDepositTx.class,
|
||||
SellerPublishesTradeStatistics.class,
|
||||
|
@ -151,22 +117,11 @@ public class DebugView extends InitializableView<GridPane, Void> {
|
|||
FXCollections.observableArrayList(Arrays.asList(
|
||||
ApplyFilter.class,
|
||||
VerifyPeersAccountAgeWitness.class,
|
||||
MakerVerifyTakerFeePayment.class,
|
||||
MakerSetsLockTime.class,
|
||||
BuyerAsMakerCreatesAndSignsDepositTx.class,
|
||||
BuyerAsMakerSendsInputsForDepositTxResponse.class,
|
||||
|
||||
BuyerProcessDelayedPayoutTxSignatureRequest.class,
|
||||
MaybeRemoveOpenOffer.class,
|
||||
BuyerVerifiesPreparedDelayedPayoutTx.class,
|
||||
BuyerSignsDelayedPayoutTx.class,
|
||||
BuyerSendsDelayedPayoutTxSignatureResponse.class,
|
||||
|
||||
BuyerProcessDepositTxAndDelayedPayoutTxMessage.class,
|
||||
BuyerVerifiesFinalDelayedPayoutTx.class,
|
||||
|
||||
ApplyFilter.class,
|
||||
MakerVerifyTakerFeePayment.class,
|
||||
BuyerPreparesPaymentSentMessage.class,
|
||||
BuyerSetupPayoutTxListener.class,
|
||||
BuyerSendsPaymentSentMessage.class,
|
||||
|
@ -180,22 +135,9 @@ public class DebugView extends InitializableView<GridPane, Void> {
|
|||
FXCollections.observableArrayList(Arrays.asList(
|
||||
ApplyFilter.class,
|
||||
TakerVerifyMakerFeePayment.class,
|
||||
BuyerAsTakerCreatesDepositTxInputs.class,
|
||||
|
||||
TakerProcessesInputsForDepositTxResponse.class,
|
||||
ApplyFilter.class,
|
||||
VerifyPeersAccountAgeWitness.class,
|
||||
TakerPublishFeeTx.class,
|
||||
BuyerAsTakerSignsDepositTx.class,
|
||||
BuyerAsTakerSendsDepositTxMessage.class,
|
||||
|
||||
BuyerProcessDelayedPayoutTxSignatureRequest.class,
|
||||
BuyerVerifiesPreparedDelayedPayoutTx.class,
|
||||
BuyerSignsDelayedPayoutTx.class,
|
||||
BuyerSendsDelayedPayoutTxSignatureResponse.class,
|
||||
|
||||
BuyerProcessDepositTxAndDelayedPayoutTxMessage.class,
|
||||
BuyerVerifiesFinalDelayedPayoutTx.class,
|
||||
|
||||
ApplyFilter.class,
|
||||
TakerVerifyMakerFeePayment.class,
|
||||
|
@ -209,30 +151,19 @@ public class DebugView extends InitializableView<GridPane, Void> {
|
|||
FXCollections.observableArrayList(Arrays.asList(
|
||||
ApplyFilter.class,
|
||||
VerifyPeersAccountAgeWitness.class,
|
||||
MakerVerifyTakerFeePayment.class,
|
||||
MakerSetsLockTime.class,
|
||||
SellerAsMakerCreatesUnsignedDepositTx.class,
|
||||
SellerAsMakerSendsInputsForDepositTxResponse.class,
|
||||
|
||||
//SellerAsMakerProcessDepositTxMessage.class,
|
||||
MaybeRemoveOpenOffer.class,
|
||||
SellerAsMakerFinalizesDepositTx.class,
|
||||
SellerCreatesDelayedPayoutTx.class,
|
||||
SellerSendDelayedPayoutTxSignatureRequest.class,
|
||||
|
||||
SellerProcessDelayedPayoutTxSignatureResponse.class,
|
||||
SellerSignsDelayedPayoutTx.class,
|
||||
SellerFinalizesDelayedPayoutTx.class,
|
||||
//SellerSendsDepositTxAndDelayedPayoutTxMessage.class,
|
||||
SellerPublishesDepositTx.class,
|
||||
SellerPublishesTradeStatistics.class,
|
||||
|
||||
SellerProcessesPaymentSentMessage.class,
|
||||
ApplyFilter.class,
|
||||
MakerVerifyTakerFeePayment.class,
|
||||
|
||||
ApplyFilter.class,
|
||||
MakerVerifyTakerFeePayment.class,
|
||||
SellerPreparesPaymentReceivedMessage.class,
|
||||
//SellerBroadcastPayoutTx.class, // TODO (woodser): removed from main pipeline; debug view?
|
||||
SellerSendsPaymentReceivedMessage.class
|
||||
|
|
|
@ -400,7 +400,7 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
|
|||
trade != null ? trade.getShortId() : "trade is null");
|
||||
|
||||
switch (tradeState) {
|
||||
// #################### Phase PREPARATION
|
||||
// preparation
|
||||
case PREPARATION:
|
||||
case CONTRACT_SIGNATURE_REQUESTED:
|
||||
case CONTRACT_SIGNED:
|
||||
|
@ -408,50 +408,23 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
|
|||
buyerState.set(BuyerState.UNDEFINED);
|
||||
break;
|
||||
|
||||
// At first part maker/taker have different roles
|
||||
// taker perspective
|
||||
// #################### Phase TAKER_FEE_PAID
|
||||
case TAKER_PUBLISHED_TAKER_FEE_TX:
|
||||
// deposit requested
|
||||
case SENT_PUBLISH_DEPOSIT_TX_REQUEST:
|
||||
case SAW_ARRIVED_PUBLISH_DEPOSIT_TX_REQUEST:
|
||||
case STORED_IN_MAILBOX_PUBLISH_DEPOSIT_TX_REQUEST:
|
||||
case SEND_FAILED_PUBLISH_DEPOSIT_TX_REQUEST:
|
||||
|
||||
// PUBLISH_DEPOSIT_TX_REQUEST
|
||||
// maker perspective
|
||||
case MAKER_SENT_PUBLISH_DEPOSIT_TX_REQUEST:
|
||||
case MAKER_SAW_ARRIVED_PUBLISH_DEPOSIT_TX_REQUEST:
|
||||
case MAKER_STORED_IN_MAILBOX_PUBLISH_DEPOSIT_TX_REQUEST:
|
||||
case MAKER_SEND_FAILED_PUBLISH_DEPOSIT_TX_REQUEST:
|
||||
|
||||
// taker perspective
|
||||
case TAKER_RECEIVED_PUBLISH_DEPOSIT_TX_REQUEST:
|
||||
// We don't have a UI state for that, we still have not a ready initiated trade
|
||||
sellerState.set(UNDEFINED);
|
||||
buyerState.set(BuyerState.UNDEFINED);
|
||||
break;
|
||||
|
||||
|
||||
// #################### Phase DEPOSIT_PAID
|
||||
case ARBITRATOR_PUBLISHED_DEPOSIT_TX:
|
||||
case TAKER_SAW_DEPOSIT_TX_IN_NETWORK:
|
||||
|
||||
// DEPOSIT_TX_PUBLISHED_MSG
|
||||
// taker perspective
|
||||
case TAKER_SENT_DEPOSIT_TX_PUBLISHED_MSG:
|
||||
case TAKER_SAW_ARRIVED_DEPOSIT_TX_PUBLISHED_MSG:
|
||||
case TAKER_STORED_IN_MAILBOX_DEPOSIT_TX_PUBLISHED_MSG:
|
||||
case TAKER_SEND_FAILED_DEPOSIT_TX_PUBLISHED_MSG:
|
||||
|
||||
// maker perspective
|
||||
case MAKER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG:
|
||||
|
||||
// Alternatively the maker could have seen the deposit tx earlier before he received the DEPOSIT_TX_PUBLISHED_MSG
|
||||
case MAKER_SAW_DEPOSIT_TX_IN_NETWORK:
|
||||
// deposit published
|
||||
case ARBITRATOR_PUBLISHED_DEPOSIT_TXS:
|
||||
case SAW_DEPOSIT_TXS_IN_NETWORK:
|
||||
buyerState.set(BuyerState.STEP1);
|
||||
sellerState.set(SellerState.STEP1);
|
||||
break;
|
||||
|
||||
|
||||
// buyer and seller step 2
|
||||
// #################### Phase DEPOSIT_UNLOCKED
|
||||
case DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN:
|
||||
// deposit unlocked
|
||||
case DEPOSIT_TXS_UNLOCKED_IN_BLOCKCHAIN:
|
||||
sellerState.set(SellerState.STEP2);
|
||||
buyerState.set(BuyerState.STEP2);
|
||||
break;
|
||||
|
|
|
@ -610,7 +610,7 @@ public class BuyerStep2View extends TradeStepView {
|
|||
|
||||
//TODO seems this was a hack to enable repeated confirm???
|
||||
if (trade.isPaymentSent()) {
|
||||
trade.setState(Trade.State.DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN);
|
||||
trade.setState(Trade.State.DEPOSIT_TXS_UNLOCKED_IN_BLOCKCHAIN);
|
||||
model.dataModel.getTradeManager().requestPersistence();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue