renames in proto and api (#277)
rename to getNewDepositAddress() rename trade phase DEPOSIT_CONFIRMED to DEPOSIT_UNLOCKED rename fiat sent/received to payment sent/received
This commit is contained in:
parent
f1b3ff6f08
commit
730bee3e71
@ -12,12 +12,9 @@ import org.junit.jupiter.api.TestInfo;
|
|||||||
import static bisq.cli.TradeFormat.format;
|
import static bisq.cli.TradeFormat.format;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import bisq.apitest.method.offer.AbstractOfferTest;
|
import bisq.apitest.method.offer.AbstractOfferTest;
|
||||||
import bisq.cli.GrpcClient;
|
|
||||||
|
|
||||||
public class AbstractTradeTest extends AbstractOfferTest {
|
public class AbstractTradeTest extends AbstractOfferTest {
|
||||||
|
|
||||||
@ -52,9 +49,9 @@ public class AbstractTradeTest extends AbstractOfferTest {
|
|||||||
if (!isLongRunningTest)
|
if (!isLongRunningTest)
|
||||||
assertEquals(EXPECTED_PROTOCOL_STATUS.isDepositPublished, trade.getIsDepositPublished());
|
assertEquals(EXPECTED_PROTOCOL_STATUS.isDepositPublished, trade.getIsDepositPublished());
|
||||||
|
|
||||||
assertEquals(EXPECTED_PROTOCOL_STATUS.isDepositConfirmed, trade.getIsDepositConfirmed());
|
assertEquals(EXPECTED_PROTOCOL_STATUS.isDepositUnlocked, trade.getIsDepositUnlocked());
|
||||||
assertEquals(EXPECTED_PROTOCOL_STATUS.isFiatSent, trade.getIsFiatSent());
|
assertEquals(EXPECTED_PROTOCOL_STATUS.isPaymentSent, trade.getIsPaymentSent());
|
||||||
assertEquals(EXPECTED_PROTOCOL_STATUS.isFiatReceived, trade.getIsFiatReceived());
|
assertEquals(EXPECTED_PROTOCOL_STATUS.isPaymentReceived, trade.getIsPaymentReceived());
|
||||||
assertEquals(EXPECTED_PROTOCOL_STATUS.isPayoutPublished, trade.getIsPayoutPublished());
|
assertEquals(EXPECTED_PROTOCOL_STATUS.isPayoutPublished, trade.getIsPayoutPublished());
|
||||||
assertEquals(EXPECTED_PROTOCOL_STATUS.isWithdrawn, trade.getIsWithdrawn());
|
assertEquals(EXPECTED_PROTOCOL_STATUS.isWithdrawn, trade.getIsWithdrawn());
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,9 @@ public class ExpectedProtocolStatus {
|
|||||||
Trade.State state;
|
Trade.State state;
|
||||||
Trade.Phase phase;
|
Trade.Phase phase;
|
||||||
boolean isDepositPublished;
|
boolean isDepositPublished;
|
||||||
boolean isDepositConfirmed;
|
boolean isDepositUnlocked;
|
||||||
boolean isFiatSent;
|
boolean isPaymentSent;
|
||||||
boolean isFiatReceived;
|
boolean isPaymentReceived;
|
||||||
boolean isPayoutPublished;
|
boolean isPayoutPublished;
|
||||||
boolean isWithdrawn;
|
boolean isWithdrawn;
|
||||||
|
|
||||||
@ -31,18 +31,18 @@ public class ExpectedProtocolStatus {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExpectedProtocolStatus setDepositConfirmed(boolean depositConfirmed) {
|
public ExpectedProtocolStatus setDepositUnlocked(boolean depositUnlocked) {
|
||||||
isDepositConfirmed = depositConfirmed;
|
isDepositUnlocked = depositUnlocked;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExpectedProtocolStatus setFiatSent(boolean fiatSent) {
|
public ExpectedProtocolStatus setFiatSent(boolean paymentSent) {
|
||||||
isFiatSent = fiatSent;
|
isPaymentSent = paymentSent;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExpectedProtocolStatus setFiatReceived(boolean fiatReceived) {
|
public ExpectedProtocolStatus setFiatReceived(boolean paymentReceived) {
|
||||||
isFiatReceived = fiatReceived;
|
isPaymentReceived = paymentReceived;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,9 +60,9 @@ public class ExpectedProtocolStatus {
|
|||||||
state = null;
|
state = null;
|
||||||
phase = null;
|
phase = null;
|
||||||
isDepositPublished = false;
|
isDepositPublished = false;
|
||||||
isDepositConfirmed = false;
|
isDepositUnlocked = false;
|
||||||
isFiatSent = false;
|
isPaymentSent = false;
|
||||||
isFiatReceived = false;
|
isPaymentReceived = false;
|
||||||
isPayoutPublished = false;
|
isPayoutPublished = false;
|
||||||
isWithdrawn = false;
|
isWithdrawn = false;
|
||||||
}
|
}
|
||||||
|
@ -36,13 +36,12 @@ import org.junit.jupiter.api.TestMethodOrder;
|
|||||||
|
|
||||||
import static bisq.cli.TableFormat.formatBalancesTbls;
|
import static bisq.cli.TableFormat.formatBalancesTbls;
|
||||||
import static bisq.core.btc.wallet.Restrictions.getDefaultBuyerSecurityDepositAsPercent;
|
import static bisq.core.btc.wallet.Restrictions.getDefaultBuyerSecurityDepositAsPercent;
|
||||||
import static bisq.core.trade.Trade.Phase.DEPOSIT_CONFIRMED;
|
import static bisq.core.trade.Trade.Phase.DEPOSIT_UNLOCKED;
|
||||||
import static bisq.core.trade.Trade.Phase.PAYMENT_SENT;
|
import static bisq.core.trade.Trade.Phase.PAYMENT_SENT;
|
||||||
import static bisq.core.trade.Trade.Phase.PAYOUT_PUBLISHED;
|
import static bisq.core.trade.Trade.Phase.PAYOUT_PUBLISHED;
|
||||||
import static bisq.core.trade.Trade.State.*;
|
import static bisq.core.trade.Trade.State.*;
|
||||||
import static java.lang.String.format;
|
import static java.lang.String.format;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
import static protobuf.Offer.State.OFFER_FEE_PAID;
|
import static protobuf.Offer.State.OFFER_FEE_PAID;
|
||||||
@ -92,8 +91,8 @@ public class TakeBuyBTCOfferTest extends AbstractTradeTest {
|
|||||||
for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) {
|
for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) {
|
||||||
trade = bobClient.getTrade(trade.getTradeId());
|
trade = bobClient.getTrade(trade.getTradeId());
|
||||||
|
|
||||||
if (!trade.getIsDepositConfirmed()) {
|
if (!trade.getIsDepositUnlocked()) {
|
||||||
log.warn("Bob still waiting on trade {} maker tx {} taker tx {}: DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN, attempt # {}",
|
log.warn("Bob still waiting on trade {} maker tx {} taker tx {}: DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN, attempt # {}",
|
||||||
trade.getShortId(),
|
trade.getShortId(),
|
||||||
trade.getMakerDepositTxId(),
|
trade.getMakerDepositTxId(),
|
||||||
trade.getTakerDepositTxId(),
|
trade.getTakerDepositTxId(),
|
||||||
@ -101,18 +100,18 @@ public class TakeBuyBTCOfferTest extends AbstractTradeTest {
|
|||||||
genBtcBlocksThenWait(1, 4000);
|
genBtcBlocksThenWait(1, 4000);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
EXPECTED_PROTOCOL_STATUS.setState(DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN)
|
EXPECTED_PROTOCOL_STATUS.setState(DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN)
|
||||||
.setPhase(DEPOSIT_CONFIRMED)
|
.setPhase(DEPOSIT_UNLOCKED)
|
||||||
.setDepositPublished(true)
|
.setDepositPublished(true)
|
||||||
.setDepositConfirmed(true);
|
.setDepositUnlocked(true);
|
||||||
verifyExpectedProtocolStatus(trade);
|
verifyExpectedProtocolStatus(trade);
|
||||||
logTrade(log, testInfo, "Bob's view after deposit is confirmed", trade, true);
|
logTrade(log, testInfo, "Bob's view after deposit is unlocked", trade, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!trade.getIsDepositConfirmed()) {
|
if (!trade.getIsDepositUnlocked()) {
|
||||||
fail(format("INVALID_PHASE for Bob's trade %s in STATE=%s PHASE=%s, deposit tx was never confirmed.",
|
fail(format("INVALID_PHASE for Bob's trade %s in STATE=%s PHASE=%s, deposit tx never unlocked.",
|
||||||
trade.getShortId(),
|
trade.getShortId(),
|
||||||
trade.getState(),
|
trade.getState(),
|
||||||
trade.getPhase()));
|
trade.getPhase()));
|
||||||
@ -130,8 +129,8 @@ public class TakeBuyBTCOfferTest extends AbstractTradeTest {
|
|||||||
var trade = aliceClient.getTrade(tradeId);
|
var trade = aliceClient.getTrade(tradeId);
|
||||||
|
|
||||||
Predicate<TradeInfo> tradeStateAndPhaseCorrect = (t) ->
|
Predicate<TradeInfo> tradeStateAndPhaseCorrect = (t) ->
|
||||||
t.getState().equals(DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN.name())
|
t.getState().equals(DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN.name())
|
||||||
&& t.getPhase().equals(DEPOSIT_CONFIRMED.name());
|
&& t.getPhase().equals(DEPOSIT_UNLOCKED.name());
|
||||||
|
|
||||||
|
|
||||||
for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) {
|
for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) {
|
||||||
@ -162,8 +161,8 @@ public class TakeBuyBTCOfferTest extends AbstractTradeTest {
|
|||||||
for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) {
|
for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) {
|
||||||
trade = aliceClient.getTrade(tradeId);
|
trade = aliceClient.getTrade(tradeId);
|
||||||
|
|
||||||
if (!trade.getIsFiatSent()) {
|
if (!trade.getIsPaymentSent()) {
|
||||||
log.warn("Alice still waiting for trade {} BUYER_SAW_ARRIVED_FIAT_PAYMENT_INITIATED_MSG, attempt # {}",
|
log.warn("Alice still waiting for trade {} BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG, attempt # {}",
|
||||||
trade.getShortId(),
|
trade.getShortId(),
|
||||||
i);
|
i);
|
||||||
sleep(5000);
|
sleep(5000);
|
||||||
|
@ -37,7 +37,7 @@ import org.junit.jupiter.api.TestMethodOrder;
|
|||||||
import static bisq.apitest.config.ApiTestConfig.BTC;
|
import static bisq.apitest.config.ApiTestConfig.BTC;
|
||||||
import static bisq.cli.TableFormat.formatBalancesTbls;
|
import static bisq.cli.TableFormat.formatBalancesTbls;
|
||||||
import static bisq.core.btc.wallet.Restrictions.getDefaultBuyerSecurityDepositAsPercent;
|
import static bisq.core.btc.wallet.Restrictions.getDefaultBuyerSecurityDepositAsPercent;
|
||||||
import static bisq.core.trade.Trade.Phase.DEPOSIT_CONFIRMED;
|
import static bisq.core.trade.Trade.Phase.DEPOSIT_UNLOCKED;
|
||||||
import static bisq.core.trade.Trade.Phase.PAYMENT_SENT;
|
import static bisq.core.trade.Trade.Phase.PAYMENT_SENT;
|
||||||
import static bisq.core.trade.Trade.Phase.PAYOUT_PUBLISHED;
|
import static bisq.core.trade.Trade.Phase.PAYOUT_PUBLISHED;
|
||||||
import static bisq.core.trade.Trade.Phase.WITHDRAWN;
|
import static bisq.core.trade.Trade.Phase.WITHDRAWN;
|
||||||
@ -45,7 +45,6 @@ import static bisq.core.trade.Trade.State.*;
|
|||||||
import static java.lang.String.format;
|
import static java.lang.String.format;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
import static protobuf.Offer.State.OFFER_FEE_PAID;
|
import static protobuf.Offer.State.OFFER_FEE_PAID;
|
||||||
import static protobuf.OfferPayload.Direction.SELL;
|
import static protobuf.OfferPayload.Direction.SELL;
|
||||||
@ -97,8 +96,8 @@ public class TakeSellBTCOfferTest extends AbstractTradeTest {
|
|||||||
for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) {
|
for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) {
|
||||||
trade = bobClient.getTrade(trade.getTradeId());
|
trade = bobClient.getTrade(trade.getTradeId());
|
||||||
|
|
||||||
if (!trade.getIsDepositConfirmed()) {
|
if (!trade.getIsDepositUnlocked()) {
|
||||||
log.warn("Bob still waiting on trade {} maker tx {} taker tx {}: DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN, attempt # {}",
|
log.warn("Bob still waiting on trade {} maker tx {} taker tx {}: DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN, attempt # {}",
|
||||||
trade.getShortId(),
|
trade.getShortId(),
|
||||||
trade.getMakerDepositTxId(),
|
trade.getMakerDepositTxId(),
|
||||||
trade.getTakerDepositTxId(),
|
trade.getTakerDepositTxId(),
|
||||||
@ -106,18 +105,18 @@ public class TakeSellBTCOfferTest extends AbstractTradeTest {
|
|||||||
genBtcBlocksThenWait(1, 4000);
|
genBtcBlocksThenWait(1, 4000);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
EXPECTED_PROTOCOL_STATUS.setState(DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN)
|
EXPECTED_PROTOCOL_STATUS.setState(DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN)
|
||||||
.setPhase(DEPOSIT_CONFIRMED)
|
.setPhase(DEPOSIT_UNLOCKED)
|
||||||
.setDepositPublished(true)
|
.setDepositPublished(true)
|
||||||
.setDepositConfirmed(true);
|
.setDepositUnlocked(true);
|
||||||
verifyExpectedProtocolStatus(trade);
|
verifyExpectedProtocolStatus(trade);
|
||||||
logTrade(log, testInfo, "Bob's view after deposit is confirmed", trade, true);
|
logTrade(log, testInfo, "Bob's view after deposit is confirmed", trade, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!trade.getIsDepositConfirmed()) {
|
if (!trade.getIsDepositUnlocked()) {
|
||||||
fail(format("INVALID_PHASE for Bob's trade %s in STATE=%s PHASE=%s, deposit tx was never confirmed.",
|
fail(format("INVALID_PHASE for Bob's trade %s in STATE=%s PHASE=%s, deposit tx never unlocked.",
|
||||||
trade.getShortId(),
|
trade.getShortId(),
|
||||||
trade.getState(),
|
trade.getState(),
|
||||||
trade.getPhase()));
|
trade.getPhase()));
|
||||||
@ -135,7 +134,7 @@ public class TakeSellBTCOfferTest extends AbstractTradeTest {
|
|||||||
var trade = bobClient.getTrade(tradeId);
|
var trade = bobClient.getTrade(tradeId);
|
||||||
|
|
||||||
Predicate<TradeInfo> tradeStateAndPhaseCorrect = (t) ->
|
Predicate<TradeInfo> tradeStateAndPhaseCorrect = (t) ->
|
||||||
t.getState().equals(DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN.name()) && t.getPhase().equals(DEPOSIT_CONFIRMED.name());
|
t.getState().equals(DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN.name()) && t.getPhase().equals(DEPOSIT_UNLOCKED.name());
|
||||||
for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) {
|
for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) {
|
||||||
if (!tradeStateAndPhaseCorrect.test(trade)) {
|
if (!tradeStateAndPhaseCorrect.test(trade)) {
|
||||||
log.warn("INVALID_PHASE for Bob's trade {} in STATE={} PHASE={}, cannot confirm payment started yet.",
|
log.warn("INVALID_PHASE for Bob's trade {} in STATE={} PHASE={}, cannot confirm payment started yet.",
|
||||||
@ -164,8 +163,8 @@ public class TakeSellBTCOfferTest extends AbstractTradeTest {
|
|||||||
for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) {
|
for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) {
|
||||||
trade = bobClient.getTrade(tradeId);
|
trade = bobClient.getTrade(tradeId);
|
||||||
|
|
||||||
if (!trade.getIsFiatSent()) {
|
if (!trade.getIsPaymentSent()) {
|
||||||
log.warn("Bob still waiting for trade {} BUYER_SAW_ARRIVED_FIAT_PAYMENT_INITIATED_MSG, attempt # {}",
|
log.warn("Bob still waiting for trade {} BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG, attempt # {}",
|
||||||
trade.getShortId(),
|
trade.getShortId(),
|
||||||
i);
|
i);
|
||||||
sleep(5000);
|
sleep(5000);
|
||||||
|
@ -225,12 +225,12 @@ public class BotClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the trade's taker deposit fee transaction has been confirmed.
|
* Returns true if the trade's taker deposit fee transaction is unlocked.
|
||||||
* @param tradeId a valid trade id
|
* @param tradeId a valid trade id
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean isTakerDepositFeeTxConfirmed(String tradeId) {
|
public boolean isTakerDepositFeeTxUnlocked(String tradeId) {
|
||||||
return grpcClient.getTrade(tradeId).getIsDepositConfirmed();
|
return grpcClient.getTrade(tradeId).getIsDepositUnlocked();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -239,7 +239,7 @@ public class BotClient {
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean isTradePaymentStartedSent(String tradeId) {
|
public boolean isTradePaymentStartedSent(String tradeId) {
|
||||||
return grpcClient.getTrade(tradeId).getIsFiatSent();
|
return grpcClient.getTrade(tradeId).getIsPaymentSent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -248,7 +248,7 @@ public class BotClient {
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean isTradePaymentReceivedConfirmationSent(String tradeId) {
|
public boolean isTradePaymentReceivedConfirmationSent(String tradeId) {
|
||||||
return grpcClient.getTrade(tradeId).getIsFiatReceived();
|
return grpcClient.getTrade(tradeId).getIsPaymentReceived();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,7 +110,7 @@ public abstract class BotProtocol {
|
|||||||
log.info("Starting protocol step {}. Bot will shutdown if step not completed within {} minutes.",
|
log.info("Starting protocol step {}. Bot will shutdown if step not completed within {} minutes.",
|
||||||
currentProtocolStep.name(), MILLISECONDS.toMinutes(protocolStepTimeLimitInMs));
|
currentProtocolStep.name(), MILLISECONDS.toMinutes(protocolStepTimeLimitInMs));
|
||||||
|
|
||||||
if (currentProtocolStep.equals(WAIT_FOR_TAKER_DEPOSIT_TX_CONFIRMED)) {
|
if (currentProtocolStep.equals(WAIT_FOR_TAKER_DEPOSIT_TX_UNLOCKED)) {
|
||||||
log.info("Generate a btc block to trigger taker's deposit fee tx confirmation.");
|
log.info("Generate a btc block to trigger taker's deposit fee tx confirmation.");
|
||||||
createGenerateBtcBlockScript();
|
createGenerateBtcBlockScript();
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ public abstract class BotProtocol {
|
|||||||
checkIfShutdownCalled("Interrupted before checking if 'payment started' message has been sent.");
|
checkIfShutdownCalled("Interrupted before checking if 'payment started' message has been sent.");
|
||||||
try {
|
try {
|
||||||
var t = this.getBotClient().getTrade(trade.getTradeId());
|
var t = this.getBotClient().getTrade(trade.getTradeId());
|
||||||
if (t.getIsFiatSent()) {
|
if (t.getIsPaymentSent()) {
|
||||||
log.info("Buyer has started payment for trade:\n{}", TradeFormat.format(t));
|
log.info("Buyer has started payment for trade:\n{}", TradeFormat.format(t));
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ public abstract class BotProtocol {
|
|||||||
checkIfShutdownCalled("Interrupted before checking if 'payment received confirmation' message has been sent.");
|
checkIfShutdownCalled("Interrupted before checking if 'payment received confirmation' message has been sent.");
|
||||||
try {
|
try {
|
||||||
var t = this.getBotClient().getTrade(trade.getTradeId());
|
var t = this.getBotClient().getTrade(trade.getTradeId());
|
||||||
if (t.getIsFiatReceived()) {
|
if (t.getIsPaymentReceived()) {
|
||||||
log.info("Seller has received payment for trade:\n{}", TradeFormat.format(t));
|
log.info("Seller has received payment for trade:\n{}", TradeFormat.format(t));
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
@ -281,12 +281,12 @@ public abstract class BotProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void waitForTakerFeeTxConfirmed(String tradeId) {
|
private void waitForTakerFeeTxConfirmed(String tradeId) {
|
||||||
waitForTakerDepositFee(tradeId, WAIT_FOR_TAKER_DEPOSIT_TX_CONFIRMED);
|
waitForTakerDepositFee(tradeId, WAIT_FOR_TAKER_DEPOSIT_TX_UNLOCKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitForTakerDepositFee(String tradeId, ProtocolStep depositTxProtocolStep) {
|
private void waitForTakerDepositFee(String tradeId, ProtocolStep depositTxProtocolStep) {
|
||||||
initProtocolStep.accept(depositTxProtocolStep);
|
initProtocolStep.accept(depositTxProtocolStep);
|
||||||
validateCurrentProtocolStep(WAIT_FOR_TAKER_DEPOSIT_TX_PUBLISHED, WAIT_FOR_TAKER_DEPOSIT_TX_CONFIRMED);
|
validateCurrentProtocolStep(WAIT_FOR_TAKER_DEPOSIT_TX_PUBLISHED, WAIT_FOR_TAKER_DEPOSIT_TX_UNLOCKED);
|
||||||
try {
|
try {
|
||||||
log.info(waitingForDepositFeeTxMsg(tradeId));
|
log.info(waitingForDepositFeeTxMsg(tradeId));
|
||||||
while (isWithinProtocolStepTimeLimit()) {
|
while (isWithinProtocolStepTimeLimit()) {
|
||||||
@ -316,8 +316,8 @@ public abstract class BotProtocol {
|
|||||||
if (currentProtocolStep.equals(WAIT_FOR_TAKER_DEPOSIT_TX_PUBLISHED) && trade.getIsDepositPublished()) {
|
if (currentProtocolStep.equals(WAIT_FOR_TAKER_DEPOSIT_TX_PUBLISHED) && trade.getIsDepositPublished()) {
|
||||||
log.info("Taker deposit fee tx {} has been published.", trade.getTakerDepositTxId());
|
log.info("Taker deposit fee tx {} has been published.", trade.getTakerDepositTxId());
|
||||||
return true;
|
return true;
|
||||||
} else if (currentProtocolStep.equals(WAIT_FOR_TAKER_DEPOSIT_TX_CONFIRMED) && trade.getIsDepositConfirmed()) {
|
} else if (currentProtocolStep.equals(WAIT_FOR_TAKER_DEPOSIT_TX_UNLOCKED) && trade.getIsDepositUnlocked()) {
|
||||||
log.info("Taker deposit fee tx {} has been confirmed.", trade.getTakerDepositTxId());
|
log.info("Taker deposit fee tx {} is unlocked.", trade.getTakerDepositTxId());
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -6,7 +6,7 @@ public enum ProtocolStep {
|
|||||||
TAKE_OFFER,
|
TAKE_OFFER,
|
||||||
WAIT_FOR_OFFER_TAKER,
|
WAIT_FOR_OFFER_TAKER,
|
||||||
WAIT_FOR_TAKER_DEPOSIT_TX_PUBLISHED,
|
WAIT_FOR_TAKER_DEPOSIT_TX_PUBLISHED,
|
||||||
WAIT_FOR_TAKER_DEPOSIT_TX_CONFIRMED,
|
WAIT_FOR_TAKER_DEPOSIT_TX_UNLOCKED,
|
||||||
SEND_PAYMENT_STARTED_MESSAGE,
|
SEND_PAYMENT_STARTED_MESSAGE,
|
||||||
WAIT_FOR_PAYMENT_STARTED_MESSAGE,
|
WAIT_FOR_PAYMENT_STARTED_MESSAGE,
|
||||||
SEND_PAYMENT_RECEIVED_CONFIRMATION_MESSAGE,
|
SEND_PAYMENT_RECEIVED_CONFIRMATION_MESSAGE,
|
||||||
|
@ -120,10 +120,10 @@ public class TradeFormat {
|
|||||||
makerTakerMinerTxFeeFormat.apply(tradeInfo, isTaker),
|
makerTakerMinerTxFeeFormat.apply(tradeInfo, isTaker),
|
||||||
makerTakerFeeFormat.apply(tradeInfo, isTaker),
|
makerTakerFeeFormat.apply(tradeInfo, isTaker),
|
||||||
tradeInfo.getIsDepositPublished() ? YES : NO,
|
tradeInfo.getIsDepositPublished() ? YES : NO,
|
||||||
tradeInfo.getIsDepositConfirmed() ? YES : NO,
|
tradeInfo.getIsDepositUnlocked() ? YES : NO,
|
||||||
tradeCostFormat.apply(tradeInfo),
|
tradeCostFormat.apply(tradeInfo),
|
||||||
tradeInfo.getIsFiatSent() ? YES : NO,
|
tradeInfo.getIsPaymentSent() ? YES : NO,
|
||||||
tradeInfo.getIsFiatReceived() ? YES : NO,
|
tradeInfo.getIsPaymentReceived() ? YES : NO,
|
||||||
tradeInfo.getIsPayoutPublished() ? YES : NO,
|
tradeInfo.getIsPayoutPublished() ? YES : NO,
|
||||||
tradeInfo.getIsWithdrawn() ? YES : NO);
|
tradeInfo.getIsWithdrawn() ? YES : NO);
|
||||||
}
|
}
|
||||||
|
@ -269,8 +269,8 @@ public class CoreApi {
|
|||||||
return walletsService.getBalances(currencyCode);
|
return walletsService.getBalances(currencyCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNewDepositSubaddress() {
|
public String getNewDepositAddress() {
|
||||||
return walletsService.getNewDepositSubaddress();
|
return walletsService.getNewDepositAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MoneroTxWallet> getXmrTxs() {
|
public List<MoneroTxWallet> getXmrTxs() {
|
||||||
|
@ -161,7 +161,7 @@ class CoreWalletsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String getNewDepositSubaddress() {
|
String getNewDepositAddress() {
|
||||||
accountService.checkAccountOpen();
|
accountService.checkAccountOpen();
|
||||||
return xmrWalletService.getWallet().createSubaddress(0).getAddress();
|
return xmrWalletService.getWallet().createSubaddress(0).getAddress();
|
||||||
}
|
}
|
||||||
|
@ -56,9 +56,9 @@ public class TradeInfo implements Payload {
|
|||||||
private final String phase;
|
private final String phase;
|
||||||
private final String tradePeriodState;
|
private final String tradePeriodState;
|
||||||
private final boolean isDepositPublished;
|
private final boolean isDepositPublished;
|
||||||
private final boolean isDepositConfirmed;
|
private final boolean isDepositUnlocked;
|
||||||
private final boolean isFiatSent;
|
private final boolean isPaymentSent;
|
||||||
private final boolean isFiatReceived;
|
private final boolean isPaymentReceived;
|
||||||
private final boolean isPayoutPublished;
|
private final boolean isPayoutPublished;
|
||||||
private final boolean isWithdrawn;
|
private final boolean isWithdrawn;
|
||||||
private final String contractAsJson;
|
private final String contractAsJson;
|
||||||
@ -83,9 +83,9 @@ public class TradeInfo implements Payload {
|
|||||||
this.phase = builder.phase;
|
this.phase = builder.phase;
|
||||||
this.tradePeriodState = builder.tradePeriodState;
|
this.tradePeriodState = builder.tradePeriodState;
|
||||||
this.isDepositPublished = builder.isDepositPublished;
|
this.isDepositPublished = builder.isDepositPublished;
|
||||||
this.isDepositConfirmed = builder.isDepositConfirmed;
|
this.isDepositUnlocked = builder.isDepositConfirmed;
|
||||||
this.isFiatSent = builder.isFiatSent;
|
this.isPaymentSent = builder.isPaymentSent;
|
||||||
this.isFiatReceived = builder.isFiatReceived;
|
this.isPaymentReceived = builder.isPaymentReceived;
|
||||||
this.isPayoutPublished = builder.isPayoutPublished;
|
this.isPayoutPublished = builder.isPayoutPublished;
|
||||||
this.isWithdrawn = builder.isWithdrawn;
|
this.isWithdrawn = builder.isWithdrawn;
|
||||||
this.contractAsJson = builder.contractAsJson;
|
this.contractAsJson = builder.contractAsJson;
|
||||||
@ -136,9 +136,9 @@ public class TradeInfo implements Payload {
|
|||||||
.withPhase(trade.getPhase().name())
|
.withPhase(trade.getPhase().name())
|
||||||
.withTradePeriodState(trade.getTradePeriodState().name())
|
.withTradePeriodState(trade.getTradePeriodState().name())
|
||||||
.withIsDepositPublished(trade.isDepositPublished())
|
.withIsDepositPublished(trade.isDepositPublished())
|
||||||
.withIsDepositConfirmed(trade.isDepositConfirmed())
|
.withIsDepositUnlocked(trade.isDepositConfirmed())
|
||||||
.withIsFiatSent(trade.isFiatSent())
|
.withIsPaymentSent(trade.isPaymentSent())
|
||||||
.withIsFiatReceived(trade.isFiatReceived())
|
.withIsPaymentReceived(trade.isPaymentReceived())
|
||||||
.withIsPayoutPublished(trade.isPayoutPublished())
|
.withIsPayoutPublished(trade.isPayoutPublished())
|
||||||
.withIsWithdrawn(trade.isWithdrawn())
|
.withIsWithdrawn(trade.isWithdrawn())
|
||||||
.withContractAsJson(trade.getContractAsJson())
|
.withContractAsJson(trade.getContractAsJson())
|
||||||
@ -171,9 +171,9 @@ public class TradeInfo implements Payload {
|
|||||||
.setPhase(phase)
|
.setPhase(phase)
|
||||||
.setTradePeriodState(tradePeriodState)
|
.setTradePeriodState(tradePeriodState)
|
||||||
.setIsDepositPublished(isDepositPublished)
|
.setIsDepositPublished(isDepositPublished)
|
||||||
.setIsDepositConfirmed(isDepositConfirmed)
|
.setIsDepositUnlocked(isDepositUnlocked)
|
||||||
.setIsFiatSent(isFiatSent)
|
.setIsPaymentSent(isPaymentSent)
|
||||||
.setIsFiatReceived(isFiatReceived)
|
.setIsPaymentReceived(isPaymentReceived)
|
||||||
.setIsPayoutPublished(isPayoutPublished)
|
.setIsPayoutPublished(isPayoutPublished)
|
||||||
.setIsWithdrawn(isWithdrawn)
|
.setIsWithdrawn(isWithdrawn)
|
||||||
.setContractAsJson(contractAsJson == null ? "" : contractAsJson)
|
.setContractAsJson(contractAsJson == null ? "" : contractAsJson)
|
||||||
@ -201,9 +201,9 @@ public class TradeInfo implements Payload {
|
|||||||
.withPhase(proto.getPhase())
|
.withPhase(proto.getPhase())
|
||||||
.withTradingPeerNodeAddress(proto.getTradingPeerNodeAddress())
|
.withTradingPeerNodeAddress(proto.getTradingPeerNodeAddress())
|
||||||
.withIsDepositPublished(proto.getIsDepositPublished())
|
.withIsDepositPublished(proto.getIsDepositPublished())
|
||||||
.withIsDepositConfirmed(proto.getIsDepositConfirmed())
|
.withIsDepositUnlocked(proto.getIsDepositUnlocked())
|
||||||
.withIsFiatSent(proto.getIsFiatSent())
|
.withIsPaymentSent(proto.getIsPaymentSent())
|
||||||
.withIsFiatReceived(proto.getIsFiatReceived())
|
.withIsPaymentReceived(proto.getIsPaymentReceived())
|
||||||
.withIsPayoutPublished(proto.getIsPayoutPublished())
|
.withIsPayoutPublished(proto.getIsPayoutPublished())
|
||||||
.withIsWithdrawn(proto.getIsWithdrawn())
|
.withIsWithdrawn(proto.getIsWithdrawn())
|
||||||
.withContractAsJson(proto.getContractAsJson())
|
.withContractAsJson(proto.getContractAsJson())
|
||||||
@ -237,8 +237,8 @@ public class TradeInfo implements Payload {
|
|||||||
private String tradePeriodState;
|
private String tradePeriodState;
|
||||||
private boolean isDepositPublished;
|
private boolean isDepositPublished;
|
||||||
private boolean isDepositConfirmed;
|
private boolean isDepositConfirmed;
|
||||||
private boolean isFiatSent;
|
private boolean isPaymentSent;
|
||||||
private boolean isFiatReceived;
|
private boolean isPaymentReceived;
|
||||||
private boolean isPayoutPublished;
|
private boolean isPayoutPublished;
|
||||||
private boolean isWithdrawn;
|
private boolean isWithdrawn;
|
||||||
private String contractAsJson;
|
private String contractAsJson;
|
||||||
@ -334,18 +334,18 @@ public class TradeInfo implements Payload {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TradeInfoBuilder withIsDepositConfirmed(boolean isDepositConfirmed) {
|
public TradeInfoBuilder withIsDepositUnlocked(boolean isDepositConfirmed) {
|
||||||
this.isDepositConfirmed = isDepositConfirmed;
|
this.isDepositConfirmed = isDepositConfirmed;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TradeInfoBuilder withIsFiatSent(boolean isFiatSent) {
|
public TradeInfoBuilder withIsPaymentSent(boolean isPaymentSent) {
|
||||||
this.isFiatSent = isFiatSent;
|
this.isPaymentSent = isPaymentSent;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TradeInfoBuilder withIsFiatReceived(boolean isFiatReceived) {
|
public TradeInfoBuilder withIsPaymentReceived(boolean isPaymentReceived) {
|
||||||
this.isFiatReceived = isFiatReceived;
|
this.isPaymentReceived = isPaymentReceived;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,9 +394,9 @@ public class TradeInfo implements Payload {
|
|||||||
", phase='" + phase + '\'' + "\n" +
|
", phase='" + phase + '\'' + "\n" +
|
||||||
", tradePeriodState='" + tradePeriodState + '\'' + "\n" +
|
", tradePeriodState='" + tradePeriodState + '\'' + "\n" +
|
||||||
", isDepositPublished=" + isDepositPublished + "\n" +
|
", isDepositPublished=" + isDepositPublished + "\n" +
|
||||||
", isDepositConfirmed=" + isDepositConfirmed + "\n" +
|
", isDepositConfirmed=" + isDepositUnlocked + "\n" +
|
||||||
", isFiatSent=" + isFiatSent + "\n" +
|
", isPaymentSent=" + isPaymentSent + "\n" +
|
||||||
", isFiatReceived=" + isFiatReceived + "\n" +
|
", isPaymentReceived=" + isPaymentReceived + "\n" +
|
||||||
", isPayoutPublished=" + isPayoutPublished + "\n" +
|
", isPayoutPublished=" + isPayoutPublished + "\n" +
|
||||||
", isWithdrawn=" + isWithdrawn + "\n" +
|
", isWithdrawn=" + isWithdrawn + "\n" +
|
||||||
", offer=" + offer + "\n" +
|
", offer=" + offer + "\n" +
|
||||||
|
@ -72,7 +72,7 @@ public class TradeEvents {
|
|||||||
case TAKER_FEE_PUBLISHED:
|
case TAKER_FEE_PUBLISHED:
|
||||||
case DEPOSIT_PUBLISHED:
|
case DEPOSIT_PUBLISHED:
|
||||||
break;
|
break;
|
||||||
case DEPOSIT_CONFIRMED:
|
case DEPOSIT_UNLOCKED:
|
||||||
if (trade.getContract() != null && pubKeyRingProvider.get().equals(trade.getContract().getBuyerPubKeyRing()))
|
if (trade.getContract() != null && pubKeyRingProvider.get().equals(trade.getContract().getBuyerPubKeyRing()))
|
||||||
msg = Res.get("account.notifications.trade.message.msg.conf", shortId);
|
msg = Res.get("account.notifications.trade.message.msg.conf", shortId);
|
||||||
break;
|
break;
|
||||||
|
@ -150,7 +150,7 @@ public abstract class Trade implements Tradable, Model {
|
|||||||
|
|
||||||
|
|
||||||
// #################### Phase DEPOSIT_CONFIRMED
|
// #################### Phase DEPOSIT_CONFIRMED
|
||||||
DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN(Phase.DEPOSIT_CONFIRMED),
|
DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN(Phase.DEPOSIT_UNLOCKED),
|
||||||
|
|
||||||
|
|
||||||
// #################### Phase PAYMENT_SENT
|
// #################### Phase PAYMENT_SENT
|
||||||
@ -217,7 +217,7 @@ public abstract class Trade implements Tradable, Model {
|
|||||||
INIT,
|
INIT,
|
||||||
TAKER_FEE_PUBLISHED, // TODO (woodser): remove unused phases
|
TAKER_FEE_PUBLISHED, // TODO (woodser): remove unused phases
|
||||||
DEPOSIT_PUBLISHED,
|
DEPOSIT_PUBLISHED,
|
||||||
DEPOSIT_CONFIRMED, // TODO (woodser): rename to or add DEPOSIT_UNLOCKED
|
DEPOSIT_UNLOCKED, // TODO (woodser): rename to or add DEPOSIT_UNLOCKED
|
||||||
PAYMENT_SENT,
|
PAYMENT_SENT,
|
||||||
PAYMENT_RECEIVED,
|
PAYMENT_RECEIVED,
|
||||||
PAYOUT_PUBLISHED,
|
PAYOUT_PUBLISHED,
|
||||||
@ -1290,14 +1290,14 @@ public abstract class Trade implements Tradable, Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDepositConfirmed() {
|
public boolean isDepositConfirmed() {
|
||||||
return getState().getPhase().ordinal() >= Phase.DEPOSIT_CONFIRMED.ordinal();
|
return getState().getPhase().ordinal() >= Phase.DEPOSIT_UNLOCKED.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFiatSent() {
|
public boolean isPaymentSent() {
|
||||||
return getState().getPhase().ordinal() >= Phase.PAYMENT_SENT.ordinal();
|
return getState().getPhase().ordinal() >= Phase.PAYMENT_SENT.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFiatReceived() {
|
public boolean isPaymentReceived() {
|
||||||
return getState().getPhase().ordinal() >= Phase.PAYMENT_RECEIVED.ordinal();
|
return getState().getPhase().ordinal() >= Phase.PAYMENT_RECEIVED.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1460,7 +1460,7 @@ public abstract class Trade implements Tradable, Model {
|
|||||||
// As setState is called here from the trade itself we cannot trigger a requestPersistence call.
|
// As setState is called here from the trade itself we cannot trigger a requestPersistence call.
|
||||||
// But as we get setupConfidenceListener called at startup anyway there is no issue if it would not be
|
// But as we get setupConfidenceListener called at startup anyway there is no issue if it would not be
|
||||||
// persisted in case the shutdown routine did not persist the trade.
|
// persisted in case the shutdown routine did not persist the trade.
|
||||||
setState(State.DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN); // TODO (woodser): for xmr this means deposit txs have unlocked after 10 confirmations
|
setState(State.DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN); // TODO (woodser): for xmr this means deposit txs have unlocked after 10 confirmations
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,10 +129,9 @@ public abstract class BuyerProtocol extends DisputeProtocol {
|
|||||||
public void onPaymentStarted(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
public void onPaymentStarted(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||||
System.out.println("BuyerProtocol.onPaymentStarted()");
|
System.out.println("BuyerProtocol.onPaymentStarted()");
|
||||||
synchronized (trade) { // TODO (woodser): UpdateMultisigWithTradingPeer sends UpdateMultisigRequest and waits for UpdateMultisigResponse which is new thread, so synchronized (trade) in subsequent pipeline blocks forever if we hold on with countdown latch in this function
|
synchronized (trade) { // TODO (woodser): UpdateMultisigWithTradingPeer sends UpdateMultisigRequest and waits for UpdateMultisigResponse which is new thread, so synchronized (trade) in subsequent pipeline blocks forever if we hold on with countdown latch in this function
|
||||||
System.out.println("BuyerProtocol.onPaymentStarted() has the lock!!!");
|
|
||||||
BuyerEvent event = BuyerEvent.PAYMENT_SENT;
|
BuyerEvent event = BuyerEvent.PAYMENT_SENT;
|
||||||
CountDownLatch latch = new CountDownLatch(1);
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
expect(phase(Trade.Phase.DEPOSIT_CONFIRMED)
|
expect(phase(Trade.Phase.DEPOSIT_UNLOCKED)
|
||||||
.with(event)
|
.with(event)
|
||||||
.preCondition(trade.confirmPermitted()))
|
.preCondition(trade.confirmPermitted()))
|
||||||
.setup(tasks(ApplyFilter.class,
|
.setup(tasks(ApplyFilter.class,
|
||||||
|
@ -61,7 +61,7 @@ public abstract class DisputeProtocol extends TradeProtocol {
|
|||||||
// Trader has not yet received the peer's signature but has clicked the accept button.
|
// Trader has not yet received the peer's signature but has clicked the accept button.
|
||||||
public void onAcceptMediationResult(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
public void onAcceptMediationResult(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||||
DisputeEvent event = DisputeEvent.MEDIATION_RESULT_ACCEPTED;
|
DisputeEvent event = DisputeEvent.MEDIATION_RESULT_ACCEPTED;
|
||||||
expect(anyPhase(Trade.Phase.DEPOSIT_CONFIRMED,
|
expect(anyPhase(Trade.Phase.DEPOSIT_UNLOCKED,
|
||||||
Trade.Phase.PAYMENT_SENT,
|
Trade.Phase.PAYMENT_SENT,
|
||||||
Trade.Phase.PAYMENT_RECEIVED)
|
Trade.Phase.PAYMENT_RECEIVED)
|
||||||
.with(event)
|
.with(event)
|
||||||
@ -88,7 +88,7 @@ public abstract class DisputeProtocol extends TradeProtocol {
|
|||||||
// Trader has already received the peer's signature and has clicked the accept button as well.
|
// Trader has already received the peer's signature and has clicked the accept button as well.
|
||||||
public void onFinalizeMediationResultPayout(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
public void onFinalizeMediationResultPayout(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
|
||||||
DisputeEvent event = DisputeEvent.MEDIATION_RESULT_ACCEPTED;
|
DisputeEvent event = DisputeEvent.MEDIATION_RESULT_ACCEPTED;
|
||||||
expect(anyPhase(Trade.Phase.DEPOSIT_CONFIRMED,
|
expect(anyPhase(Trade.Phase.DEPOSIT_UNLOCKED,
|
||||||
Trade.Phase.PAYMENT_SENT,
|
Trade.Phase.PAYMENT_SENT,
|
||||||
Trade.Phase.PAYMENT_RECEIVED)
|
Trade.Phase.PAYMENT_RECEIVED)
|
||||||
.with(event)
|
.with(event)
|
||||||
@ -117,7 +117,7 @@ public abstract class DisputeProtocol extends TradeProtocol {
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
protected void handle(MediatedPayoutTxSignatureMessage message, NodeAddress peer) {
|
protected void handle(MediatedPayoutTxSignatureMessage message, NodeAddress peer) {
|
||||||
expect(anyPhase(Trade.Phase.DEPOSIT_CONFIRMED,
|
expect(anyPhase(Trade.Phase.DEPOSIT_UNLOCKED,
|
||||||
Trade.Phase.PAYMENT_SENT,
|
Trade.Phase.PAYMENT_SENT,
|
||||||
Trade.Phase.PAYMENT_RECEIVED)
|
Trade.Phase.PAYMENT_RECEIVED)
|
||||||
.with(message)
|
.with(message)
|
||||||
@ -127,7 +127,7 @@ public abstract class DisputeProtocol extends TradeProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void handle(MediatedPayoutTxPublishedMessage message, NodeAddress peer) {
|
protected void handle(MediatedPayoutTxPublishedMessage message, NodeAddress peer) {
|
||||||
expect(anyPhase(Trade.Phase.DEPOSIT_CONFIRMED,
|
expect(anyPhase(Trade.Phase.DEPOSIT_UNLOCKED,
|
||||||
Trade.Phase.PAYMENT_SENT,
|
Trade.Phase.PAYMENT_SENT,
|
||||||
Trade.Phase.PAYMENT_RECEIVED)
|
Trade.Phase.PAYMENT_RECEIVED)
|
||||||
.with(message)
|
.with(message)
|
||||||
@ -167,7 +167,7 @@ public abstract class DisputeProtocol extends TradeProtocol {
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private void handle(PeerPublishedDelayedPayoutTxMessage message, NodeAddress peer) {
|
private void handle(PeerPublishedDelayedPayoutTxMessage message, NodeAddress peer) {
|
||||||
expect(anyPhase(Trade.Phase.DEPOSIT_CONFIRMED,
|
expect(anyPhase(Trade.Phase.DEPOSIT_UNLOCKED,
|
||||||
Trade.Phase.PAYMENT_SENT,
|
Trade.Phase.PAYMENT_SENT,
|
||||||
Trade.Phase.PAYMENT_RECEIVED)
|
Trade.Phase.PAYMENT_RECEIVED)
|
||||||
.with(message)
|
.with(message)
|
||||||
|
@ -85,7 +85,7 @@ public abstract class SellerProtocol extends DisputeProtocol {
|
|||||||
// the mailbox msg once wallet is ready and trade state set.
|
// the mailbox msg once wallet is ready and trade state set.
|
||||||
synchronized (trade) {
|
synchronized (trade) {
|
||||||
//CountDownLatch latch = new CountDownLatch(1); // TODO: apply latch countdown
|
//CountDownLatch latch = new CountDownLatch(1); // TODO: apply latch countdown
|
||||||
expect(anyPhase(Trade.Phase.DEPOSIT_CONFIRMED, Trade.Phase.DEPOSIT_PUBLISHED)
|
expect(anyPhase(Trade.Phase.DEPOSIT_UNLOCKED, Trade.Phase.DEPOSIT_PUBLISHED)
|
||||||
.with(message)
|
.with(message)
|
||||||
.from(peer)
|
.from(peer)
|
||||||
.preCondition(trade.getPayoutTx() == null,
|
.preCondition(trade.getPayoutTx() == null,
|
||||||
|
@ -192,7 +192,7 @@ public class BuyerSendsPaymentSentMessage extends SendMailboxMessageTask {
|
|||||||
private void onMessageStateChange(MessageState newValue) {
|
private void onMessageStateChange(MessageState newValue) {
|
||||||
// Once we receive an ACK from our msg we know the peer has received the msg and we stop.
|
// Once we receive an ACK from our msg we know the peer has received the msg and we stop.
|
||||||
if (newValue == MessageState.ACKNOWLEDGED) {
|
if (newValue == MessageState.ACKNOWLEDGED) {
|
||||||
// We treat a ACK like BUYER_SAW_ARRIVED_FIAT_PAYMENT_INITIATED_MSG
|
// We treat a ACK like BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG
|
||||||
trade.setStateIfValidTransitionTo(Trade.State.BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG);
|
trade.setStateIfValidTransitionTo(Trade.State.BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG);
|
||||||
|
|
||||||
processModel.getTradeManager().requestPersistence();
|
processModel.getTradeManager().requestPersistence();
|
||||||
|
@ -197,7 +197,7 @@ public class XmrTxProofService implements AssetTxProofService {
|
|||||||
.filter(trade -> trade instanceof SellerTrade)
|
.filter(trade -> trade instanceof SellerTrade)
|
||||||
.map(trade -> (SellerTrade) trade)
|
.map(trade -> (SellerTrade) trade)
|
||||||
.filter(this::isXmrTrade)
|
.filter(this::isXmrTrade)
|
||||||
.filter(trade -> !trade.isFiatReceived()) // Phase name is from the time when it was fiat only. Means counter currency (XMR) received.
|
.filter(trade -> !trade.isPaymentReceived()) // Phase name is from the time when it was fiat only. Means counter currency (XMR) received.
|
||||||
.forEach(this::processTradeOrAddListener);
|
.forEach(this::processTradeOrAddListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ public class XmrTxProofService implements AssetTxProofService {
|
|||||||
if (isExpectedTradeState(trade.getState())) {
|
if (isExpectedTradeState(trade.getState())) {
|
||||||
startRequestsIfValid(trade);
|
startRequestsIfValid(trade);
|
||||||
} else {
|
} else {
|
||||||
// We are expecting SELLER_RECEIVED_FIAT_PAYMENT_INITIATED_MSG in the future, so listen on changes
|
// We are expecting SELLER_RECEIVED_PAYMENT_INITIATED_MSG in the future, so listen on changes
|
||||||
ChangeListener<Trade.State> tradeStateListener = (observable, oldValue, newValue) -> {
|
ChangeListener<Trade.State> tradeStateListener = (observable, oldValue, newValue) -> {
|
||||||
if (isExpectedTradeState(newValue)) {
|
if (isExpectedTradeState(newValue)) {
|
||||||
ChangeListener<Trade.State> listener = tradeStateListenerMap.remove(trade.getId());
|
ChangeListener<Trade.State> listener = tradeStateListenerMap.remove(trade.getId());
|
||||||
|
@ -28,8 +28,8 @@ import bisq.proto.grpc.GetBalancesReply;
|
|||||||
import bisq.proto.grpc.GetBalancesRequest;
|
import bisq.proto.grpc.GetBalancesRequest;
|
||||||
import bisq.proto.grpc.GetFundingAddressesReply;
|
import bisq.proto.grpc.GetFundingAddressesReply;
|
||||||
import bisq.proto.grpc.GetFundingAddressesRequest;
|
import bisq.proto.grpc.GetFundingAddressesRequest;
|
||||||
import bisq.proto.grpc.GetNewDepositSubaddressRequest;
|
import bisq.proto.grpc.GetNewDepositAddressRequest;
|
||||||
import bisq.proto.grpc.GetNewDepositSubaddressReply;
|
import bisq.proto.grpc.GetNewDepositAddressReply;
|
||||||
import bisq.proto.grpc.GetXmrTxsRequest;
|
import bisq.proto.grpc.GetXmrTxsRequest;
|
||||||
import bisq.proto.grpc.GetXmrTxsReply;
|
import bisq.proto.grpc.GetXmrTxsReply;
|
||||||
import bisq.proto.grpc.CreateXmrTxRequest;
|
import bisq.proto.grpc.CreateXmrTxRequest;
|
||||||
@ -118,11 +118,11 @@ class GrpcWalletsService extends WalletsImplBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getNewDepositSubaddress(GetNewDepositSubaddressRequest req,
|
public void getNewDepositAddress(GetNewDepositAddressRequest req,
|
||||||
StreamObserver<GetNewDepositSubaddressReply> responseObserver) {
|
StreamObserver<GetNewDepositAddressReply> responseObserver) {
|
||||||
try {
|
try {
|
||||||
String subaddress = coreApi.getNewDepositSubaddress();
|
String subaddress = coreApi.getNewDepositAddress();
|
||||||
var reply = GetNewDepositSubaddressReply.newBuilder()
|
var reply = GetNewDepositAddressReply.newBuilder()
|
||||||
.setSubaddress(subaddress)
|
.setSubaddress(subaddress)
|
||||||
.build();
|
.build();
|
||||||
responseObserver.onNext(reply);
|
responseObserver.onNext(reply);
|
||||||
|
@ -192,7 +192,7 @@ public class NotificationCenter {
|
|||||||
message = Res.get("notification.trade.accepted", role);
|
message = Res.get("notification.trade.accepted", role);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trade instanceof BuyerTrade && phase.ordinal() == Trade.Phase.DEPOSIT_CONFIRMED.ordinal())
|
if (trade instanceof BuyerTrade && phase.ordinal() == Trade.Phase.DEPOSIT_UNLOCKED.ordinal())
|
||||||
message = Res.get("notification.trade.confirmed");
|
message = Res.get("notification.trade.confirmed");
|
||||||
else if (trade instanceof SellerTrade && phase.ordinal() == Trade.Phase.PAYMENT_SENT.ordinal())
|
else if (trade instanceof SellerTrade && phase.ordinal() == Trade.Phase.PAYMENT_SENT.ordinal())
|
||||||
message = Res.get("notification.trade.paymentStarted");
|
message = Res.get("notification.trade.paymentStarted");
|
||||||
|
@ -445,29 +445,29 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
|
|||||||
|
|
||||||
|
|
||||||
// buyer and seller step 2
|
// buyer and seller step 2
|
||||||
// #################### Phase DEPOSIT_CONFIRMED
|
// #################### Phase DEPOSIT_UNLOCKED
|
||||||
case DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN:
|
case DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN:
|
||||||
sellerState.set(SellerState.STEP2);
|
sellerState.set(SellerState.STEP2);
|
||||||
buyerState.set(BuyerState.STEP2);
|
buyerState.set(BuyerState.STEP2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// buyer step 3
|
// buyer step 3
|
||||||
case BUYER_CONFIRMED_IN_UI_PAYMENT_INITIATED: // UI action
|
case BUYER_CONFIRMED_IN_UI_PAYMENT_INITIATED: // UI action
|
||||||
case BUYER_SENT_PAYMENT_INITIATED_MSG: // FIAT_PAYMENT_INITIATED_MSG sent
|
case BUYER_SENT_PAYMENT_INITIATED_MSG: // PAYMENT_INITIATED_MSG sent
|
||||||
// We don't switch the UI before we got the feedback of the msg delivery
|
// We don't switch the UI before we got the feedback of the msg delivery
|
||||||
buyerState.set(BuyerState.STEP2);
|
buyerState.set(BuyerState.STEP2);
|
||||||
break;
|
break;
|
||||||
case BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG: // FIAT_PAYMENT_INITIATED_MSG arrived
|
case BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG: // PAYMENT_INITIATED_MSG arrived
|
||||||
case BUYER_STORED_IN_MAILBOX_PAYMENT_INITIATED_MSG: // FIAT_PAYMENT_INITIATED_MSG in mailbox
|
case BUYER_STORED_IN_MAILBOX_PAYMENT_INITIATED_MSG: // PAYMENT_INITIATED_MSG in mailbox
|
||||||
buyerState.set(BuyerState.STEP3);
|
buyerState.set(BuyerState.STEP3);
|
||||||
break;
|
break;
|
||||||
case BUYER_SEND_FAILED_PAYMENT_INITIATED_MSG: // FIAT_PAYMENT_INITIATED_MSG failed
|
case BUYER_SEND_FAILED_PAYMENT_INITIATED_MSG: // PAYMENT_INITIATED_MSG failed
|
||||||
// if failed we need to repeat sending so back to step 2
|
// if failed we need to repeat sending so back to step 2
|
||||||
buyerState.set(BuyerState.STEP2);
|
buyerState.set(BuyerState.STEP2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// seller step 3
|
// seller step 3
|
||||||
case SELLER_RECEIVED_PAYMENT_INITIATED_MSG: // FIAT_PAYMENT_INITIATED_MSG received
|
case SELLER_RECEIVED_PAYMENT_INITIATED_MSG: // PAYMENT_INITIATED_MSG received
|
||||||
sellerState.set(SellerState.STEP3);
|
sellerState.set(SellerState.STEP3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -771,7 +771,7 @@ public abstract class TradeStepView extends AnchorPane {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SECOND_HALF:
|
case SECOND_HALF:
|
||||||
if (!trade.isFiatReceived()) {
|
if (!trade.isPaymentReceived()) {
|
||||||
if (tradeStepInfo != null) {
|
if (tradeStepInfo != null) {
|
||||||
tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getFirstHalfOverWarnText);
|
tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getFirstHalfOverWarnText);
|
||||||
tradeStepInfo.setState(TradeStepInfo.State.WARN_HALF_PERIOD);
|
tradeStepInfo.setState(TradeStepInfo.State.WARN_HALF_PERIOD);
|
||||||
|
@ -133,7 +133,7 @@ public class BuyerStep2View extends TradeStepView {
|
|||||||
if (timeoutTimer != null)
|
if (timeoutTimer != null)
|
||||||
timeoutTimer.stop();
|
timeoutTimer.stop();
|
||||||
|
|
||||||
if (trade.isDepositConfirmed() && !trade.isFiatSent()) {
|
if (trade.isDepositConfirmed() && !trade.isPaymentSent()) {
|
||||||
showPopup();
|
showPopup();
|
||||||
} else if (state.ordinal() <= Trade.State.BUYER_SEND_FAILED_PAYMENT_INITIATED_MSG.ordinal()) {
|
} else if (state.ordinal() <= Trade.State.BUYER_SEND_FAILED_PAYMENT_INITIATED_MSG.ordinal()) {
|
||||||
if (!trade.hasFailed()) {
|
if (!trade.hasFailed()) {
|
||||||
@ -523,8 +523,8 @@ public class BuyerStep2View extends TradeStepView {
|
|||||||
statusLabel.setText(Res.get("shared.sendingConfirmation"));
|
statusLabel.setText(Res.get("shared.sendingConfirmation"));
|
||||||
|
|
||||||
//TODO seems this was a hack to enable repeated confirm???
|
//TODO seems this was a hack to enable repeated confirm???
|
||||||
if (trade.isFiatSent()) {
|
if (trade.isPaymentSent()) {
|
||||||
trade.setState(Trade.State.DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN);
|
trade.setState(Trade.State.DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN);
|
||||||
model.dataModel.getTradeManager().requestPersistence();
|
model.dataModel.getTradeManager().requestPersistence();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,9 +111,9 @@ public class SellerStep3View extends TradeStepView {
|
|||||||
if (timeoutTimer != null)
|
if (timeoutTimer != null)
|
||||||
timeoutTimer.stop();
|
timeoutTimer.stop();
|
||||||
|
|
||||||
if (trade.isFiatSent() && !trade.isFiatReceived()) {
|
if (trade.isPaymentSent() && !trade.isPaymentReceived()) {
|
||||||
showPopup();
|
showPopup();
|
||||||
} else if (trade.isFiatReceived()) {
|
} else if (trade.isPaymentReceived()) {
|
||||||
if (!trade.hasFailed()) {
|
if (!trade.hasFailed()) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case SELLER_CONFIRMED_IN_UI_PAYMENT_RECEIPT:
|
case SELLER_CONFIRMED_IN_UI_PAYMENT_RECEIPT:
|
||||||
|
@ -792,9 +792,9 @@ message TradeInfo {
|
|||||||
string phase = 16;
|
string phase = 16;
|
||||||
string trade_period_state = 17;
|
string trade_period_state = 17;
|
||||||
bool is_deposit_published = 18;
|
bool is_deposit_published = 18;
|
||||||
bool is_deposit_confirmed = 19;
|
bool is_deposit_unlocked = 19;
|
||||||
bool is_fiat_sent = 20;
|
bool is_payment_sent = 20;
|
||||||
bool is_fiat_received = 21;
|
bool is_payment_received = 21;
|
||||||
bool is_payout_published = 22;
|
bool is_payout_published = 22;
|
||||||
bool is_withdrawn = 23;
|
bool is_withdrawn = 23;
|
||||||
string contract_as_json = 24;
|
string contract_as_json = 24;
|
||||||
@ -856,7 +856,7 @@ message TxInfo {
|
|||||||
service Wallets {
|
service Wallets {
|
||||||
rpc GetBalances (GetBalancesRequest) returns (GetBalancesReply) {
|
rpc GetBalances (GetBalancesRequest) returns (GetBalancesReply) {
|
||||||
}
|
}
|
||||||
rpc GetNewDepositSubaddress (GetNewDepositSubaddressRequest) returns (GetNewDepositSubaddressReply) {
|
rpc GetNewDepositAddress (GetNewDepositAddressRequest) returns (GetNewDepositAddressReply) {
|
||||||
}
|
}
|
||||||
rpc GetXmrTxs (GetXmrTxsRequest) returns (GetXmrTxsReply) {
|
rpc GetXmrTxs (GetXmrTxsRequest) returns (GetXmrTxsReply) {
|
||||||
}
|
}
|
||||||
@ -896,10 +896,10 @@ message GetBalancesReply {
|
|||||||
BalancesInfo balances = 1;
|
BalancesInfo balances = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetNewDepositSubaddressRequest {
|
message GetNewDepositAddressRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetNewDepositSubaddressReply {
|
message GetNewDepositAddressReply {
|
||||||
string subaddress = 1;
|
string subaddress = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1523,7 +1523,7 @@ message Trade {
|
|||||||
TAKER_SEND_FAILED_DEPOSIT_TX_PUBLISHED_MSG = 15;
|
TAKER_SEND_FAILED_DEPOSIT_TX_PUBLISHED_MSG = 15;
|
||||||
MAKER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG = 16;
|
MAKER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG = 16;
|
||||||
MAKER_SAW_DEPOSIT_TX_IN_NETWORK = 17;
|
MAKER_SAW_DEPOSIT_TX_IN_NETWORK = 17;
|
||||||
DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN = 18;
|
DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN = 18;
|
||||||
BUYER_CONFIRMED_IN_UI_PAYMENT_INITIATED = 19;
|
BUYER_CONFIRMED_IN_UI_PAYMENT_INITIATED = 19;
|
||||||
BUYER_SENT_PAYMENT_INITIATED_MSG = 20;
|
BUYER_SENT_PAYMENT_INITIATED_MSG = 20;
|
||||||
BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG = 21;
|
BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG = 21;
|
||||||
|
Loading…
Reference in New Issue
Block a user