diff --git a/apitest/src/test/java/bisq/apitest/method/trade/AbstractTradeTest.java b/apitest/src/test/java/bisq/apitest/method/trade/AbstractTradeTest.java index 408dc343d8..b389b6d6fb 100644 --- a/apitest/src/test/java/bisq/apitest/method/trade/AbstractTradeTest.java +++ b/apitest/src/test/java/bisq/apitest/method/trade/AbstractTradeTest.java @@ -43,10 +43,16 @@ public class AbstractTradeTest extends AbstractOfferTest { @Getter protected static String tradeId; - protected final Supplier maxTradeStateAndPhaseChecks = () -> isLongRunningTest ? 10 : 2; + protected final Supplier maxTradeStateAndPhaseChecks = () -> + isLongRunningTest + ? 10 + : 2; protected final Function toTradeDetailTable = (trade) -> new TableBuilder(TRADE_DETAIL_TBL, trade).build().toString(); - protected final Function toUserName = (client) -> client.equals(aliceClient) ? "Alice" : "Bob"; + protected final Function toUserName = (client) -> + client.equals(aliceClient) + ? "Alice" + : "Bob"; @BeforeAll public static void initStaticFixtures() { @@ -87,17 +93,17 @@ public class AbstractTradeTest extends AbstractOfferTest { return trade; } - protected final void waitForDepositConfirmation(Logger log, - TestInfo testInfo, - GrpcClient grpcClient, - String tradeId) { + protected final void waitForTakerDepositConfirmation(Logger log, + TestInfo testInfo, + GrpcClient takerClient, + String tradeId) { Predicate isTradeInDepositConfirmedStateAndPhase = (t) -> t.getState().equals(DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN.name()) && t.getPhase().equals(DEPOSIT_CONFIRMED.name()); - String userName = toUserName.apply(grpcClient); + String userName = toUserName.apply(takerClient); for (int i = 1; i <= maxTradeStateAndPhaseChecks.get(); i++) { - TradeInfo trade = grpcClient.getTrade(tradeId); + TradeInfo trade = takerClient.getTrade(tradeId); if (!isTradeInDepositConfirmedStateAndPhase.test(trade)) { log.warn("{} still waiting on trade {} tx {}: DEPOSIT_CONFIRMED_IN_BLOCK_CHAIN, attempt # {}", userName, diff --git a/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBSQOfferTest.java b/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBSQOfferTest.java index c9df07de75..923a243b28 100644 --- a/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBSQOfferTest.java +++ b/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBSQOfferTest.java @@ -101,7 +101,7 @@ public class TakeBuyBSQOfferTest extends AbstractTradeTest { alicesBsqOffers = aliceClient.getMyOffersSortedByDate(BSQ); assertEquals(0, alicesBsqOffers.size()); - waitForDepositConfirmation(log, testInfo, bobClient, trade.getTradeId()); + waitForTakerDepositConfirmation(log, testInfo, bobClient, trade.getTradeId()); genBtcBlocksThenWait(1, 2_500); trade = bobClient.getTrade(tradeId); diff --git a/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferTest.java b/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferTest.java index 6f339dfcb0..54d20acc23 100644 --- a/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferTest.java +++ b/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferTest.java @@ -108,7 +108,7 @@ public class TakeBuyBTCOfferTest extends AbstractTradeTest { // Now generate the BTC block to confirm the taker deposit tx. genBtcBlocksThenWait(1, 2_500); - waitForDepositConfirmation(log, testInfo, bobClient, tradeId); + waitForTakerDepositConfirmation(log, testInfo, bobClient, tradeId); // Verify the seller can only send a payment rcvd msg after the payment started msg. verifyPaymentReceivedMsgAfterPaymentSentMsgPrecondition(log, bobClient); @@ -122,7 +122,7 @@ public class TakeBuyBTCOfferTest extends AbstractTradeTest { public void testAlicesConfirmPaymentStarted(final TestInfo testInfo) { try { var trade = aliceClient.getTrade(tradeId); - waitForDepositConfirmation(log, testInfo, aliceClient, trade.getTradeId()); + waitForTakerDepositConfirmation(log, testInfo, aliceClient, trade.getTradeId()); aliceClient.confirmPaymentStarted(trade.getTradeId()); sleep(6_000); waitUntilBuyerSeesPaymentStartedMessage(log, testInfo, aliceClient, tradeId); diff --git a/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferWithNationalBankAcctTest.java b/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferWithNationalBankAcctTest.java index ad5c5e84ff..d1b7efd349 100644 --- a/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferWithNationalBankAcctTest.java +++ b/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferWithNationalBankAcctTest.java @@ -145,7 +145,7 @@ public class TakeBuyBTCOfferWithNationalBankAcctTest extends AbstractTradeTest { alicesOffers = aliceClient.getMyOffersSortedByDate(BUY.name(), BRL); assertEquals(0, alicesOffers.size()); genBtcBlocksThenWait(1, 2_500); - waitForDepositConfirmation(log, testInfo, bobClient, trade.getTradeId()); + waitForTakerDepositConfirmation(log, testInfo, bobClient, trade.getTradeId()); trade = bobClient.getTrade(tradeId); verifyTakerDepositConfirmed(trade); @@ -182,7 +182,7 @@ public class TakeBuyBTCOfferWithNationalBankAcctTest extends AbstractTradeTest { public void testAlicesConfirmPaymentStarted(final TestInfo testInfo) { try { var trade = aliceClient.getTrade(tradeId); - waitForDepositConfirmation(log, testInfo, aliceClient, trade.getTradeId()); + waitForTakerDepositConfirmation(log, testInfo, aliceClient, trade.getTradeId()); aliceClient.confirmPaymentStarted(trade.getTradeId()); sleep(6_000); waitUntilBuyerSeesPaymentStartedMessage(log, testInfo, aliceClient, tradeId); diff --git a/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyXMROfferTest.java b/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyXMROfferTest.java index 3577593048..5e85a866e9 100644 --- a/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyXMROfferTest.java +++ b/apitest/src/test/java/bisq/apitest/method/trade/TakeBuyXMROfferTest.java @@ -115,7 +115,7 @@ public class TakeBuyXMROfferTest extends AbstractTradeTest { // Now generate the BTC block to confirm the taker deposit tx. genBtcBlocksThenWait(1, 2_500); - waitForDepositConfirmation(log, testInfo, bobClient, tradeId); + waitForTakerDepositConfirmation(log, testInfo, bobClient, tradeId); // Verify the seller can only send a payment rcvd msg after the payment started msg. verifyPaymentReceivedMsgAfterPaymentSentMsgPrecondition(log, aliceClient); diff --git a/apitest/src/test/java/bisq/apitest/method/trade/TakeSellBSQOfferTest.java b/apitest/src/test/java/bisq/apitest/method/trade/TakeSellBSQOfferTest.java index 9d710f717d..efd0a6c77a 100644 --- a/apitest/src/test/java/bisq/apitest/method/trade/TakeSellBSQOfferTest.java +++ b/apitest/src/test/java/bisq/apitest/method/trade/TakeSellBSQOfferTest.java @@ -82,7 +82,7 @@ public class TakeSellBSQOfferTest extends AbstractTradeTest { alicesLegacyBsqAcct.getId(), TRADE_FEE_CURRENCY_CODE); log.debug("Alice's SELL BSQ (BUY BTC) Offer:\n{}", new TableBuilder(OFFER_TBL, alicesOffer).build()); - genBtcBlocksThenWait(1, 4_000); + genBtcBlocksThenWait(1, 2_500); var offerId = alicesOffer.getId(); assertTrue(alicesOffer.getIsCurrencyForMakerFeeBtc()); var alicesBsqOffers = aliceClient.getMyOffers(btcTradeDirection, BSQ); @@ -95,7 +95,7 @@ public class TakeSellBSQOfferTest extends AbstractTradeTest { alicesBsqOffers = aliceClient.getMyOffersSortedByDate(BSQ); assertEquals(0, alicesBsqOffers.size()); genBtcBlocksThenWait(1, 2_500); - waitForDepositConfirmation(log, testInfo, bobClient, trade.getTradeId()); + waitForTakerDepositConfirmation(log, testInfo, bobClient, trade.getTradeId()); trade = bobClient.getTrade(tradeId); verifyTakerDepositConfirmed(trade); logTrade(log, testInfo, "Alice's Maker/Seller View", aliceClient.getTrade(tradeId)); @@ -110,7 +110,7 @@ public class TakeSellBSQOfferTest extends AbstractTradeTest { public void testAlicesConfirmPaymentStarted(final TestInfo testInfo) { try { var trade = aliceClient.getTrade(tradeId); - waitForDepositConfirmation(log, testInfo, aliceClient, trade.getTradeId()); + waitForTakerDepositConfirmation(log, testInfo, aliceClient, trade.getTradeId()); sendBsqPayment(log, aliceClient, trade); genBtcBlocksThenWait(1, 2_500); aliceClient.confirmPaymentStarted(trade.getTradeId()); diff --git a/apitest/src/test/java/bisq/apitest/method/trade/TakeSellBTCOfferTest.java b/apitest/src/test/java/bisq/apitest/method/trade/TakeSellBTCOfferTest.java index 5cc5dc7da4..6d9f2e450a 100644 --- a/apitest/src/test/java/bisq/apitest/method/trade/TakeSellBTCOfferTest.java +++ b/apitest/src/test/java/bisq/apitest/method/trade/TakeSellBTCOfferTest.java @@ -112,7 +112,7 @@ public class TakeSellBTCOfferTest extends AbstractTradeTest { // Now generate the BTC block to confirm the taker deposit tx. genBtcBlocksThenWait(1, 2_500); - waitForDepositConfirmation(log, testInfo, bobClient, tradeId); + waitForTakerDepositConfirmation(log, testInfo, bobClient, tradeId); // Verify the seller can only send a payment rcvd msg after the payment started msg. verifyPaymentReceivedMsgAfterPaymentSentMsgPrecondition(log, aliceClient); diff --git a/apitest/src/test/java/bisq/apitest/method/trade/TakeSellXMROfferTest.java b/apitest/src/test/java/bisq/apitest/method/trade/TakeSellXMROfferTest.java index 71eafa38a1..90c8fe1007 100644 --- a/apitest/src/test/java/bisq/apitest/method/trade/TakeSellXMROfferTest.java +++ b/apitest/src/test/java/bisq/apitest/method/trade/TakeSellXMROfferTest.java @@ -118,7 +118,7 @@ public class TakeSellXMROfferTest extends AbstractTradeTest { // Now generate the BTC block to confirm the taker deposit tx. genBtcBlocksThenWait(1, 2_500); - waitForDepositConfirmation(log, testInfo, bobClient, tradeId); + waitForTakerDepositConfirmation(log, testInfo, bobClient, tradeId); // Verify the seller can only send a payment rcvd msg after the payment started msg. verifyPaymentReceivedMsgAfterPaymentSentMsgPrecondition(log, bobClient); @@ -132,10 +132,10 @@ public class TakeSellXMROfferTest extends AbstractTradeTest { public void testAlicesConfirmPaymentStarted(final TestInfo testInfo) { try { var trade = aliceClient.getTrade(tradeId); - waitForDepositConfirmation(log, testInfo, aliceClient, trade.getTradeId()); + waitForTakerDepositConfirmation(log, testInfo, aliceClient, trade.getTradeId()); log.debug("Alice sends XMR payment to Bob for trade {}", trade.getTradeId()); aliceClient.confirmPaymentStarted(trade.getTradeId()); - sleep(3500); + sleep(3_500); waitUntilBuyerSeesPaymentStartedMessage(log, testInfo, aliceClient, tradeId); logTrade(log, testInfo, "Alice's Maker/Seller View (Payment Sent)", aliceClient.getTrade(tradeId));