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:
woodser 2022-04-07 10:45:35 -04:00 committed by GitHub
parent f1b3ff6f08
commit 730bee3e71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 127 additions and 133 deletions

View File

@ -12,12 +12,9 @@ import org.junit.jupiter.api.TestInfo;
import static bisq.cli.TradeFormat.format;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.fail;
import bisq.apitest.method.offer.AbstractOfferTest;
import bisq.cli.GrpcClient;
public class AbstractTradeTest extends AbstractOfferTest {
@ -52,9 +49,9 @@ public class AbstractTradeTest extends AbstractOfferTest {
if (!isLongRunningTest)
assertEquals(EXPECTED_PROTOCOL_STATUS.isDepositPublished, trade.getIsDepositPublished());
assertEquals(EXPECTED_PROTOCOL_STATUS.isDepositConfirmed, trade.getIsDepositConfirmed());
assertEquals(EXPECTED_PROTOCOL_STATUS.isFiatSent, trade.getIsFiatSent());
assertEquals(EXPECTED_PROTOCOL_STATUS.isFiatReceived, trade.getIsFiatReceived());
assertEquals(EXPECTED_PROTOCOL_STATUS.isDepositUnlocked, trade.getIsDepositUnlocked());
assertEquals(EXPECTED_PROTOCOL_STATUS.isPaymentSent, trade.getIsPaymentSent());
assertEquals(EXPECTED_PROTOCOL_STATUS.isPaymentReceived, trade.getIsPaymentReceived());
assertEquals(EXPECTED_PROTOCOL_STATUS.isPayoutPublished, trade.getIsPayoutPublished());
assertEquals(EXPECTED_PROTOCOL_STATUS.isWithdrawn, trade.getIsWithdrawn());
}

View File

@ -10,9 +10,9 @@ public class ExpectedProtocolStatus {
Trade.State state;
Trade.Phase phase;
boolean isDepositPublished;
boolean isDepositConfirmed;
boolean isFiatSent;
boolean isFiatReceived;
boolean isDepositUnlocked;
boolean isPaymentSent;
boolean isPaymentReceived;
boolean isPayoutPublished;
boolean isWithdrawn;
@ -31,18 +31,18 @@ public class ExpectedProtocolStatus {
return this;
}
public ExpectedProtocolStatus setDepositConfirmed(boolean depositConfirmed) {
isDepositConfirmed = depositConfirmed;
public ExpectedProtocolStatus setDepositUnlocked(boolean depositUnlocked) {
isDepositUnlocked = depositUnlocked;
return this;
}
public ExpectedProtocolStatus setFiatSent(boolean fiatSent) {
isFiatSent = fiatSent;
public ExpectedProtocolStatus setFiatSent(boolean paymentSent) {
isPaymentSent = paymentSent;
return this;
}
public ExpectedProtocolStatus setFiatReceived(boolean fiatReceived) {
isFiatReceived = fiatReceived;
public ExpectedProtocolStatus setFiatReceived(boolean paymentReceived) {
isPaymentReceived = paymentReceived;
return this;
}
@ -60,9 +60,9 @@ public class ExpectedProtocolStatus {
state = null;
phase = null;
isDepositPublished = false;
isDepositConfirmed = false;
isFiatSent = false;
isFiatReceived = false;
isDepositUnlocked = false;
isPaymentSent = false;
isPaymentReceived = false;
isPayoutPublished = false;
isWithdrawn = false;
}

View File

@ -36,13 +36,12 @@ import org.junit.jupiter.api.TestMethodOrder;
import static bisq.cli.TableFormat.formatBalancesTbls;
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.PAYOUT_PUBLISHED;
import static bisq.core.trade.Trade.State.*;
import static java.lang.String.format;
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.fail;
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++) {
trade = bobClient.getTrade(trade.getTradeId());
if (!trade.getIsDepositConfirmed()) {
log.warn("Bob still waiting on trade {} maker tx {} taker tx {}: DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN, attempt # {}",
if (!trade.getIsDepositUnlocked()) {
log.warn("Bob still waiting on trade {} maker tx {} taker tx {}: DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN, attempt # {}",
trade.getShortId(),
trade.getMakerDepositTxId(),
trade.getTakerDepositTxId(),
@ -101,18 +100,18 @@ public class TakeBuyBTCOfferTest extends AbstractTradeTest {
genBtcBlocksThenWait(1, 4000);
continue;
} else {
EXPECTED_PROTOCOL_STATUS.setState(DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN)
.setPhase(DEPOSIT_CONFIRMED)
EXPECTED_PROTOCOL_STATUS.setState(DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN)
.setPhase(DEPOSIT_UNLOCKED)
.setDepositPublished(true)
.setDepositConfirmed(true);
.setDepositUnlocked(true);
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;
}
}
if (!trade.getIsDepositConfirmed()) {
fail(format("INVALID_PHASE for Bob's trade %s in STATE=%s PHASE=%s, deposit tx was never confirmed.",
if (!trade.getIsDepositUnlocked()) {
fail(format("INVALID_PHASE for Bob's trade %s in STATE=%s PHASE=%s, deposit tx never unlocked.",
trade.getShortId(),
trade.getState(),
trade.getPhase()));
@ -130,8 +129,8 @@ public class TakeBuyBTCOfferTest extends AbstractTradeTest {
var trade = aliceClient.getTrade(tradeId);
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++) {
@ -162,8 +161,8 @@ public class TakeBuyBTCOfferTest extends AbstractTradeTest {
for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) {
trade = aliceClient.getTrade(tradeId);
if (!trade.getIsFiatSent()) {
log.warn("Alice still waiting for trade {} BUYER_SAW_ARRIVED_FIAT_PAYMENT_INITIATED_MSG, attempt # {}",
if (!trade.getIsPaymentSent()) {
log.warn("Alice still waiting for trade {} BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG, attempt # {}",
trade.getShortId(),
i);
sleep(5000);

View File

@ -37,7 +37,7 @@ import org.junit.jupiter.api.TestMethodOrder;
import static bisq.apitest.config.ApiTestConfig.BTC;
import static bisq.cli.TableFormat.formatBalancesTbls;
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.PAYOUT_PUBLISHED;
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 org.junit.jupiter.api.Assertions.assertEquals;
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 protobuf.Offer.State.OFFER_FEE_PAID;
import static protobuf.OfferPayload.Direction.SELL;
@ -97,8 +96,8 @@ public class TakeSellBTCOfferTest extends AbstractTradeTest {
for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) {
trade = bobClient.getTrade(trade.getTradeId());
if (!trade.getIsDepositConfirmed()) {
log.warn("Bob still waiting on trade {} maker tx {} taker tx {}: DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN, attempt # {}",
if (!trade.getIsDepositUnlocked()) {
log.warn("Bob still waiting on trade {} maker tx {} taker tx {}: DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN, attempt # {}",
trade.getShortId(),
trade.getMakerDepositTxId(),
trade.getTakerDepositTxId(),
@ -106,18 +105,18 @@ public class TakeSellBTCOfferTest extends AbstractTradeTest {
genBtcBlocksThenWait(1, 4000);
continue;
} else {
EXPECTED_PROTOCOL_STATUS.setState(DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN)
.setPhase(DEPOSIT_CONFIRMED)
EXPECTED_PROTOCOL_STATUS.setState(DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN)
.setPhase(DEPOSIT_UNLOCKED)
.setDepositPublished(true)
.setDepositConfirmed(true);
.setDepositUnlocked(true);
verifyExpectedProtocolStatus(trade);
logTrade(log, testInfo, "Bob's view after deposit is confirmed", trade, true);
break;
}
}
if (!trade.getIsDepositConfirmed()) {
fail(format("INVALID_PHASE for Bob's trade %s in STATE=%s PHASE=%s, deposit tx was never confirmed.",
if (!trade.getIsDepositUnlocked()) {
fail(format("INVALID_PHASE for Bob's trade %s in STATE=%s PHASE=%s, deposit tx never unlocked.",
trade.getShortId(),
trade.getState(),
trade.getPhase()));
@ -135,7 +134,7 @@ public class TakeSellBTCOfferTest extends AbstractTradeTest {
var trade = bobClient.getTrade(tradeId);
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++) {
if (!tradeStateAndPhaseCorrect.test(trade)) {
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++) {
trade = bobClient.getTrade(tradeId);
if (!trade.getIsFiatSent()) {
log.warn("Bob still waiting for trade {} BUYER_SAW_ARRIVED_FIAT_PAYMENT_INITIATED_MSG, attempt # {}",
if (!trade.getIsPaymentSent()) {
log.warn("Bob still waiting for trade {} BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG, attempt # {}",
trade.getShortId(),
i);
sleep(5000);

View File

@ -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
* @return boolean
*/
public boolean isTakerDepositFeeTxConfirmed(String tradeId) {
return grpcClient.getTrade(tradeId).getIsDepositConfirmed();
public boolean isTakerDepositFeeTxUnlocked(String tradeId) {
return grpcClient.getTrade(tradeId).getIsDepositUnlocked();
}
/**
@ -239,7 +239,7 @@ public class BotClient {
* @return boolean
*/
public boolean isTradePaymentStartedSent(String tradeId) {
return grpcClient.getTrade(tradeId).getIsFiatSent();
return grpcClient.getTrade(tradeId).getIsPaymentSent();
}
/**
@ -248,7 +248,7 @@ public class BotClient {
* @return boolean
*/
public boolean isTradePaymentReceivedConfirmationSent(String tradeId) {
return grpcClient.getTrade(tradeId).getIsFiatReceived();
return grpcClient.getTrade(tradeId).getIsPaymentReceived();
}
/**

View File

@ -110,7 +110,7 @@ public abstract class BotProtocol {
log.info("Starting protocol step {}. Bot will shutdown if step not completed within {} minutes.",
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.");
createGenerateBtcBlockScript();
}
@ -132,7 +132,7 @@ public abstract class BotProtocol {
checkIfShutdownCalled("Interrupted before checking if 'payment started' message has been sent.");
try {
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));
return t;
}
@ -166,7 +166,7 @@ public abstract class BotProtocol {
checkIfShutdownCalled("Interrupted before checking if 'payment received confirmation' message has been sent.");
try {
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));
return t;
}
@ -281,12 +281,12 @@ public abstract class BotProtocol {
}
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) {
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 {
log.info(waitingForDepositFeeTxMsg(tradeId));
while (isWithinProtocolStepTimeLimit()) {
@ -316,8 +316,8 @@ public abstract class BotProtocol {
if (currentProtocolStep.equals(WAIT_FOR_TAKER_DEPOSIT_TX_PUBLISHED) && trade.getIsDepositPublished()) {
log.info("Taker deposit fee tx {} has been published.", trade.getTakerDepositTxId());
return true;
} else if (currentProtocolStep.equals(WAIT_FOR_TAKER_DEPOSIT_TX_CONFIRMED) && trade.getIsDepositConfirmed()) {
log.info("Taker deposit fee tx {} has been confirmed.", trade.getTakerDepositTxId());
} else if (currentProtocolStep.equals(WAIT_FOR_TAKER_DEPOSIT_TX_UNLOCKED) && trade.getIsDepositUnlocked()) {
log.info("Taker deposit fee tx {} is unlocked.", trade.getTakerDepositTxId());
return true;
} else {
return false;

View File

@ -6,7 +6,7 @@ public enum ProtocolStep {
TAKE_OFFER,
WAIT_FOR_OFFER_TAKER,
WAIT_FOR_TAKER_DEPOSIT_TX_PUBLISHED,
WAIT_FOR_TAKER_DEPOSIT_TX_CONFIRMED,
WAIT_FOR_TAKER_DEPOSIT_TX_UNLOCKED,
SEND_PAYMENT_STARTED_MESSAGE,
WAIT_FOR_PAYMENT_STARTED_MESSAGE,
SEND_PAYMENT_RECEIVED_CONFIRMATION_MESSAGE,

View File

@ -120,10 +120,10 @@ public class TradeFormat {
makerTakerMinerTxFeeFormat.apply(tradeInfo, isTaker),
makerTakerFeeFormat.apply(tradeInfo, isTaker),
tradeInfo.getIsDepositPublished() ? YES : NO,
tradeInfo.getIsDepositConfirmed() ? YES : NO,
tradeInfo.getIsDepositUnlocked() ? YES : NO,
tradeCostFormat.apply(tradeInfo),
tradeInfo.getIsFiatSent() ? YES : NO,
tradeInfo.getIsFiatReceived() ? YES : NO,
tradeInfo.getIsPaymentSent() ? YES : NO,
tradeInfo.getIsPaymentReceived() ? YES : NO,
tradeInfo.getIsPayoutPublished() ? YES : NO,
tradeInfo.getIsWithdrawn() ? YES : NO);
}

View File

@ -269,8 +269,8 @@ public class CoreApi {
return walletsService.getBalances(currencyCode);
}
public String getNewDepositSubaddress() {
return walletsService.getNewDepositSubaddress();
public String getNewDepositAddress() {
return walletsService.getNewDepositAddress();
}
public List<MoneroTxWallet> getXmrTxs() {

View File

@ -161,7 +161,7 @@ class CoreWalletsService {
}
}
String getNewDepositSubaddress() {
String getNewDepositAddress() {
accountService.checkAccountOpen();
return xmrWalletService.getWallet().createSubaddress(0).getAddress();
}

View File

@ -56,9 +56,9 @@ public class TradeInfo implements Payload {
private final String phase;
private final String tradePeriodState;
private final boolean isDepositPublished;
private final boolean isDepositConfirmed;
private final boolean isFiatSent;
private final boolean isFiatReceived;
private final boolean isDepositUnlocked;
private final boolean isPaymentSent;
private final boolean isPaymentReceived;
private final boolean isPayoutPublished;
private final boolean isWithdrawn;
private final String contractAsJson;
@ -83,9 +83,9 @@ public class TradeInfo implements Payload {
this.phase = builder.phase;
this.tradePeriodState = builder.tradePeriodState;
this.isDepositPublished = builder.isDepositPublished;
this.isDepositConfirmed = builder.isDepositConfirmed;
this.isFiatSent = builder.isFiatSent;
this.isFiatReceived = builder.isFiatReceived;
this.isDepositUnlocked = builder.isDepositConfirmed;
this.isPaymentSent = builder.isPaymentSent;
this.isPaymentReceived = builder.isPaymentReceived;
this.isPayoutPublished = builder.isPayoutPublished;
this.isWithdrawn = builder.isWithdrawn;
this.contractAsJson = builder.contractAsJson;
@ -136,9 +136,9 @@ public class TradeInfo implements Payload {
.withPhase(trade.getPhase().name())
.withTradePeriodState(trade.getTradePeriodState().name())
.withIsDepositPublished(trade.isDepositPublished())
.withIsDepositConfirmed(trade.isDepositConfirmed())
.withIsFiatSent(trade.isFiatSent())
.withIsFiatReceived(trade.isFiatReceived())
.withIsDepositUnlocked(trade.isDepositConfirmed())
.withIsPaymentSent(trade.isPaymentSent())
.withIsPaymentReceived(trade.isPaymentReceived())
.withIsPayoutPublished(trade.isPayoutPublished())
.withIsWithdrawn(trade.isWithdrawn())
.withContractAsJson(trade.getContractAsJson())
@ -171,9 +171,9 @@ public class TradeInfo implements Payload {
.setPhase(phase)
.setTradePeriodState(tradePeriodState)
.setIsDepositPublished(isDepositPublished)
.setIsDepositConfirmed(isDepositConfirmed)
.setIsFiatSent(isFiatSent)
.setIsFiatReceived(isFiatReceived)
.setIsDepositUnlocked(isDepositUnlocked)
.setIsPaymentSent(isPaymentSent)
.setIsPaymentReceived(isPaymentReceived)
.setIsPayoutPublished(isPayoutPublished)
.setIsWithdrawn(isWithdrawn)
.setContractAsJson(contractAsJson == null ? "" : contractAsJson)
@ -201,9 +201,9 @@ public class TradeInfo implements Payload {
.withPhase(proto.getPhase())
.withTradingPeerNodeAddress(proto.getTradingPeerNodeAddress())
.withIsDepositPublished(proto.getIsDepositPublished())
.withIsDepositConfirmed(proto.getIsDepositConfirmed())
.withIsFiatSent(proto.getIsFiatSent())
.withIsFiatReceived(proto.getIsFiatReceived())
.withIsDepositUnlocked(proto.getIsDepositUnlocked())
.withIsPaymentSent(proto.getIsPaymentSent())
.withIsPaymentReceived(proto.getIsPaymentReceived())
.withIsPayoutPublished(proto.getIsPayoutPublished())
.withIsWithdrawn(proto.getIsWithdrawn())
.withContractAsJson(proto.getContractAsJson())
@ -237,8 +237,8 @@ public class TradeInfo implements Payload {
private String tradePeriodState;
private boolean isDepositPublished;
private boolean isDepositConfirmed;
private boolean isFiatSent;
private boolean isFiatReceived;
private boolean isPaymentSent;
private boolean isPaymentReceived;
private boolean isPayoutPublished;
private boolean isWithdrawn;
private String contractAsJson;
@ -334,18 +334,18 @@ public class TradeInfo implements Payload {
return this;
}
public TradeInfoBuilder withIsDepositConfirmed(boolean isDepositConfirmed) {
public TradeInfoBuilder withIsDepositUnlocked(boolean isDepositConfirmed) {
this.isDepositConfirmed = isDepositConfirmed;
return this;
}
public TradeInfoBuilder withIsFiatSent(boolean isFiatSent) {
this.isFiatSent = isFiatSent;
public TradeInfoBuilder withIsPaymentSent(boolean isPaymentSent) {
this.isPaymentSent = isPaymentSent;
return this;
}
public TradeInfoBuilder withIsFiatReceived(boolean isFiatReceived) {
this.isFiatReceived = isFiatReceived;
public TradeInfoBuilder withIsPaymentReceived(boolean isPaymentReceived) {
this.isPaymentReceived = isPaymentReceived;
return this;
}
@ -394,9 +394,9 @@ public class TradeInfo implements Payload {
", phase='" + phase + '\'' + "\n" +
", tradePeriodState='" + tradePeriodState + '\'' + "\n" +
", isDepositPublished=" + isDepositPublished + "\n" +
", isDepositConfirmed=" + isDepositConfirmed + "\n" +
", isFiatSent=" + isFiatSent + "\n" +
", isFiatReceived=" + isFiatReceived + "\n" +
", isDepositConfirmed=" + isDepositUnlocked + "\n" +
", isPaymentSent=" + isPaymentSent + "\n" +
", isPaymentReceived=" + isPaymentReceived + "\n" +
", isPayoutPublished=" + isPayoutPublished + "\n" +
", isWithdrawn=" + isWithdrawn + "\n" +
", offer=" + offer + "\n" +

View File

@ -72,7 +72,7 @@ public class TradeEvents {
case TAKER_FEE_PUBLISHED:
case DEPOSIT_PUBLISHED:
break;
case DEPOSIT_CONFIRMED:
case DEPOSIT_UNLOCKED:
if (trade.getContract() != null && pubKeyRingProvider.get().equals(trade.getContract().getBuyerPubKeyRing()))
msg = Res.get("account.notifications.trade.message.msg.conf", shortId);
break;

View File

@ -150,7 +150,7 @@ public abstract class Trade implements Tradable, Model {
// #################### Phase DEPOSIT_CONFIRMED
DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN(Phase.DEPOSIT_CONFIRMED),
DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN(Phase.DEPOSIT_UNLOCKED),
// #################### Phase PAYMENT_SENT
@ -217,7 +217,7 @@ public abstract class Trade implements Tradable, Model {
INIT,
TAKER_FEE_PUBLISHED, // TODO (woodser): remove unused phases
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_RECEIVED,
PAYOUT_PUBLISHED,
@ -1290,14 +1290,14 @@ public abstract class Trade implements Tradable, Model {
}
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();
}
public boolean isFiatReceived() {
public boolean isPaymentReceived() {
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.
// 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.
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
}
}

View File

@ -129,10 +129,9 @@ public abstract class BuyerProtocol extends DisputeProtocol {
public void onPaymentStarted(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
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
System.out.println("BuyerProtocol.onPaymentStarted() has the lock!!!");
BuyerEvent event = BuyerEvent.PAYMENT_SENT;
CountDownLatch latch = new CountDownLatch(1);
expect(phase(Trade.Phase.DEPOSIT_CONFIRMED)
expect(phase(Trade.Phase.DEPOSIT_UNLOCKED)
.with(event)
.preCondition(trade.confirmPermitted()))
.setup(tasks(ApplyFilter.class,

View File

@ -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.
public void onAcceptMediationResult(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
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_RECEIVED)
.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.
public void onFinalizeMediationResultPayout(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
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_RECEIVED)
.with(event)
@ -117,7 +117,7 @@ public abstract class DisputeProtocol extends TradeProtocol {
///////////////////////////////////////////////////////////////////////////////////////////
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_RECEIVED)
.with(message)
@ -127,7 +127,7 @@ public abstract class DisputeProtocol extends TradeProtocol {
}
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_RECEIVED)
.with(message)
@ -167,7 +167,7 @@ public abstract class DisputeProtocol extends TradeProtocol {
///////////////////////////////////////////////////////////////////////////////////////////
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_RECEIVED)
.with(message)

View File

@ -85,7 +85,7 @@ public abstract class SellerProtocol extends DisputeProtocol {
// the mailbox msg once wallet is ready and trade state set.
synchronized (trade) {
//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)
.from(peer)
.preCondition(trade.getPayoutTx() == null,

View File

@ -192,7 +192,7 @@ public class BuyerSendsPaymentSentMessage extends SendMailboxMessageTask {
private void onMessageStateChange(MessageState newValue) {
// Once we receive an ACK from our msg we know the peer has received the msg and we stop.
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);
processModel.getTradeManager().requestPersistence();

View File

@ -197,7 +197,7 @@ public class XmrTxProofService implements AssetTxProofService {
.filter(trade -> trade instanceof SellerTrade)
.map(trade -> (SellerTrade) trade)
.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);
}
@ -207,7 +207,7 @@ public class XmrTxProofService implements AssetTxProofService {
if (isExpectedTradeState(trade.getState())) {
startRequestsIfValid(trade);
} 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) -> {
if (isExpectedTradeState(newValue)) {
ChangeListener<Trade.State> listener = tradeStateListenerMap.remove(trade.getId());

View File

@ -28,8 +28,8 @@ import bisq.proto.grpc.GetBalancesReply;
import bisq.proto.grpc.GetBalancesRequest;
import bisq.proto.grpc.GetFundingAddressesReply;
import bisq.proto.grpc.GetFundingAddressesRequest;
import bisq.proto.grpc.GetNewDepositSubaddressRequest;
import bisq.proto.grpc.GetNewDepositSubaddressReply;
import bisq.proto.grpc.GetNewDepositAddressRequest;
import bisq.proto.grpc.GetNewDepositAddressReply;
import bisq.proto.grpc.GetXmrTxsRequest;
import bisq.proto.grpc.GetXmrTxsReply;
import bisq.proto.grpc.CreateXmrTxRequest;
@ -118,11 +118,11 @@ class GrpcWalletsService extends WalletsImplBase {
}
@Override
public void getNewDepositSubaddress(GetNewDepositSubaddressRequest req,
StreamObserver<GetNewDepositSubaddressReply> responseObserver) {
public void getNewDepositAddress(GetNewDepositAddressRequest req,
StreamObserver<GetNewDepositAddressReply> responseObserver) {
try {
String subaddress = coreApi.getNewDepositSubaddress();
var reply = GetNewDepositSubaddressReply.newBuilder()
String subaddress = coreApi.getNewDepositAddress();
var reply = GetNewDepositAddressReply.newBuilder()
.setSubaddress(subaddress)
.build();
responseObserver.onNext(reply);

View File

@ -192,7 +192,7 @@ public class NotificationCenter {
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");
else if (trade instanceof SellerTrade && phase.ordinal() == Trade.Phase.PAYMENT_SENT.ordinal())
message = Res.get("notification.trade.paymentStarted");

View File

@ -445,29 +445,29 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
// buyer and seller step 2
// #################### Phase DEPOSIT_CONFIRMED
case DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN:
// #################### Phase DEPOSIT_UNLOCKED
case DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN:
sellerState.set(SellerState.STEP2);
buyerState.set(BuyerState.STEP2);
break;
// buyer step 3
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
buyerState.set(BuyerState.STEP2);
break;
case BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG: // FIAT_PAYMENT_INITIATED_MSG arrived
case BUYER_STORED_IN_MAILBOX_PAYMENT_INITIATED_MSG: // FIAT_PAYMENT_INITIATED_MSG in mailbox
case BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG: // PAYMENT_INITIATED_MSG arrived
case BUYER_STORED_IN_MAILBOX_PAYMENT_INITIATED_MSG: // PAYMENT_INITIATED_MSG in mailbox
buyerState.set(BuyerState.STEP3);
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
buyerState.set(BuyerState.STEP2);
break;
// 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);
break;

View File

@ -771,7 +771,7 @@ public abstract class TradeStepView extends AnchorPane {
}
break;
case SECOND_HALF:
if (!trade.isFiatReceived()) {
if (!trade.isPaymentReceived()) {
if (tradeStepInfo != null) {
tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getFirstHalfOverWarnText);
tradeStepInfo.setState(TradeStepInfo.State.WARN_HALF_PERIOD);

View File

@ -133,7 +133,7 @@ public class BuyerStep2View extends TradeStepView {
if (timeoutTimer != null)
timeoutTimer.stop();
if (trade.isDepositConfirmed() && !trade.isFiatSent()) {
if (trade.isDepositConfirmed() && !trade.isPaymentSent()) {
showPopup();
} else if (state.ordinal() <= Trade.State.BUYER_SEND_FAILED_PAYMENT_INITIATED_MSG.ordinal()) {
if (!trade.hasFailed()) {
@ -523,8 +523,8 @@ public class BuyerStep2View extends TradeStepView {
statusLabel.setText(Res.get("shared.sendingConfirmation"));
//TODO seems this was a hack to enable repeated confirm???
if (trade.isFiatSent()) {
trade.setState(Trade.State.DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN);
if (trade.isPaymentSent()) {
trade.setState(Trade.State.DEPOSIT_UNLOCKED_IN_BLOCK_CHAIN);
model.dataModel.getTradeManager().requestPersistence();
}

View File

@ -111,9 +111,9 @@ public class SellerStep3View extends TradeStepView {
if (timeoutTimer != null)
timeoutTimer.stop();
if (trade.isFiatSent() && !trade.isFiatReceived()) {
if (trade.isPaymentSent() && !trade.isPaymentReceived()) {
showPopup();
} else if (trade.isFiatReceived()) {
} else if (trade.isPaymentReceived()) {
if (!trade.hasFailed()) {
switch (state) {
case SELLER_CONFIRMED_IN_UI_PAYMENT_RECEIPT:

View File

@ -792,9 +792,9 @@ message TradeInfo {
string phase = 16;
string trade_period_state = 17;
bool is_deposit_published = 18;
bool is_deposit_confirmed = 19;
bool is_fiat_sent = 20;
bool is_fiat_received = 21;
bool is_deposit_unlocked = 19;
bool is_payment_sent = 20;
bool is_payment_received = 21;
bool is_payout_published = 22;
bool is_withdrawn = 23;
string contract_as_json = 24;
@ -856,7 +856,7 @@ message TxInfo {
service Wallets {
rpc GetBalances (GetBalancesRequest) returns (GetBalancesReply) {
}
rpc GetNewDepositSubaddress (GetNewDepositSubaddressRequest) returns (GetNewDepositSubaddressReply) {
rpc GetNewDepositAddress (GetNewDepositAddressRequest) returns (GetNewDepositAddressReply) {
}
rpc GetXmrTxs (GetXmrTxsRequest) returns (GetXmrTxsReply) {
}
@ -896,10 +896,10 @@ message GetBalancesReply {
BalancesInfo balances = 1;
}
message GetNewDepositSubaddressRequest {
message GetNewDepositAddressRequest {
}
message GetNewDepositSubaddressReply {
message GetNewDepositAddressReply {
string subaddress = 1;
}

View File

@ -1523,7 +1523,7 @@ message Trade {
TAKER_SEND_FAILED_DEPOSIT_TX_PUBLISHED_MSG = 15;
MAKER_RECEIVED_DEPOSIT_TX_PUBLISHED_MSG = 16;
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_SENT_PAYMENT_INITIATED_MSG = 20;
BUYER_SAW_ARRIVED_PAYMENT_INITIATED_MSG = 21;