Merge branch '08-gettransaction' into 09-refactor-grpc-error-handling

Adjust to reverting 6aa385e.
This commit is contained in:
ghubstan 2020-12-21 15:35:15 -03:00
commit 8ee3a1599c
No known key found for this signature in database
GPG key ID: E35592D6800A861E
9 changed files with 21 additions and 61 deletions

View file

@ -65,9 +65,12 @@ import org.junit.jupiter.api.TestMethodOrder;
import static bisq.apitest.Scaffold.BitcoinCoreApp.bitcoind;
import static bisq.apitest.config.BisqAppConfig.alicedaemon;
import static bisq.core.locale.CurrencyUtil.*;
import static bisq.core.locale.CurrencyUtil.getAllAdvancedCashCurrencies;
import static bisq.core.locale.CurrencyUtil.getAllMoneyGramCurrencies;
import static bisq.core.locale.CurrencyUtil.getAllRevolutCurrencies;
import static bisq.core.locale.CurrencyUtil.getAllUpholdCurrencies;
import static bisq.core.payment.payload.PaymentMethod.*;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
@ -746,7 +749,6 @@ public class CreatePaymentAccountTest extends AbstractPaymentAccountTest {
String jsonString = getCompletedFormAsJsonString();
TransferwiseAccount paymentAccount = (TransferwiseAccount) createPaymentAccount(alicedaemon, jsonString);
verifyUserPayloadHasPaymentAccountWithId(paymentAccount.getId());
verifyUserPayloadHasPaymentAccountWithId(paymentAccount.getId());
// As per commit 88f26f93241af698ae689bf081205d0f9dc929fa
// Do not autofill all currencies by default but keep all unselected.
// verifyAccountTradeCurrencies(getAllTransferwiseCurrencies(), paymentAccount);

View file

@ -33,7 +33,6 @@ import org.junit.jupiter.api.TestMethodOrder;
import static bisq.apitest.config.BisqAppConfig.alicedaemon;
import static bisq.apitest.config.BisqAppConfig.bobdaemon;
import static bisq.cli.CurrencyFormat.formatSatoshis;
import static bisq.cli.TransactionFormat.format;
import static bisq.core.trade.Trade.Phase.*;
import static bisq.core.trade.Trade.State.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -165,19 +164,4 @@ public class TakeSellBTCOfferTest extends AbstractTradeTest {
testName(testInfo),
formatSatoshis(currentBalance.getAvailableBalance()));
}
@Test
@Order(5)
public void testGetTradeWithdrawalTx(final TestInfo testInfo) {
var trade = getTrade(bobdaemon, tradeId);
var withdrawalTxId = trade.getWithdrawalTxId();
assertNotNull(withdrawalTxId);
var txInfo = getTransaction(bobdaemon, withdrawalTxId);
assertEquals(WITHDRAWAL_TX_MEMO, txInfo.getMemo());
log.debug("{} Trade withdrawal Tx:\n{}",
testName(testInfo),
format(txInfo));
}
}

View file

@ -60,6 +60,5 @@ public class TradeTest extends AbstractTradeTest {
test.testBobsConfirmPaymentStarted(testInfo);
test.testAlicesConfirmPaymentReceived(testInfo);
test.testBobsBtcWithdrawalToExternalAddress(testInfo);
test.testGetTradeWithdrawalTx(testInfo);
}
}

View file

@ -58,7 +58,6 @@ public class TradeFormat {
+ COL_HEADER_TRADE_FIAT_RECEIVED + COL_HEADER_DELIMITER
+ COL_HEADER_TRADE_PAYOUT_PUBLISHED + COL_HEADER_DELIMITER
+ COL_HEADER_TRADE_WITHDRAWN + COL_HEADER_DELIMITER
+ (tradeInfo.getIsWithdrawn() ? COL_HEADER_TRADE_WITHDRAWAL_TX_ID + COL_HEADER_DELIMITER : "")
+ "%n";
String counterCurrencyCode = tradeInfo.getOffer().getCounterCurrencyCode();
@ -79,8 +78,7 @@ public class TradeFormat {
+ " %-" + COL_HEADER_TRADE_FIAT_SENT.length() + "s" // lt justify
+ " %-" + COL_HEADER_TRADE_FIAT_RECEIVED.length() + "s" // lt justify
+ " %-" + COL_HEADER_TRADE_PAYOUT_PUBLISHED.length() + "s" // lt justify
+ " %-" + COL_HEADER_TRADE_WITHDRAWN.length() + "s" // lt justify
+ " %-" + COL_HEADER_TRADE_WITHDRAWAL_TX_ID.length() + "s"; // left
+ " %-" + COL_HEADER_TRADE_WITHDRAWN.length() + "s"; // lt justify
return headerLine +
(isTaker
@ -100,8 +98,7 @@ public class TradeFormat {
tradeInfo.getIsFiatSent() ? "YES" : "NO",
tradeInfo.getIsFiatReceived() ? "YES" : "NO",
tradeInfo.getIsPayoutPublished() ? "YES" : "NO",
tradeInfo.getIsWithdrawn() ? "YES" : "NO",
tradeInfo.getIsWithdrawn() ? tradeInfo.getWithdrawalTxId() : "");
tradeInfo.getIsWithdrawn() ? "YES" : "NO");
}
private static String formatTradeForTaker(String format, TradeInfo tradeInfo) {
@ -117,7 +114,6 @@ public class TradeFormat {
tradeInfo.getIsFiatSent() ? "YES" : "NO",
tradeInfo.getIsFiatReceived() ? "YES" : "NO",
tradeInfo.getIsPayoutPublished() ? "YES" : "NO",
tradeInfo.getIsWithdrawn() ? "YES" : "NO",
tradeInfo.getIsWithdrawn() ? tradeInfo.getWithdrawalTxId() : "");
tradeInfo.getIsWithdrawn() ? "YES" : "NO");
}
}

View file

@ -47,7 +47,6 @@ public class TradeInfo implements Payload {
private final String takerFeeTxId;
private final String depositTxId;
private final String payoutTxId;
private final String withdrawalTxId;
private final long tradeAmountAsLong;
private final long tradePrice;
private final String tradingPeerNodeAddress;
@ -74,7 +73,6 @@ public class TradeInfo implements Payload {
this.takerFeeTxId = builder.takerFeeTxId;
this.depositTxId = builder.depositTxId;
this.payoutTxId = builder.payoutTxId;
this.withdrawalTxId = builder.withdrawalTxId;
this.tradeAmountAsLong = builder.tradeAmountAsLong;
this.tradePrice = builder.tradePrice;
this.tradingPeerNodeAddress = builder.tradingPeerNodeAddress;
@ -108,7 +106,6 @@ public class TradeInfo implements Payload {
.withTakerFeeTxId(trade.getTakerFeeTxId())
.withDepositTxId(trade.getDepositTxId())
.withPayoutTxId(trade.getPayoutTxId())
.withWithdrawalTxId(trade.getWithdrawalTxId())
.withTradeAmountAsLong(trade.getTradeAmountAsLong())
.withTradePrice(trade.getTradePrice().getValue())
.withTradingPeerNodeAddress(Objects.requireNonNull(
@ -144,7 +141,6 @@ public class TradeInfo implements Payload {
.setTakerFeeTxId(takerFeeTxId == null ? "" : takerFeeTxId)
.setDepositTxId(depositTxId == null ? "" : depositTxId)
.setPayoutTxId(payoutTxId == null ? "" : payoutTxId)
.setWithdrawalTxId(withdrawalTxId == null ? "" : withdrawalTxId)
.setTradeAmountAsLong(tradeAmountAsLong)
.setTradePrice(tradePrice)
.setTradingPeerNodeAddress(tradingPeerNodeAddress)
@ -184,7 +180,6 @@ public class TradeInfo implements Payload {
private String takerFeeTxId;
private String depositTxId;
private String payoutTxId;
private String withdrawalTxId;
private long tradeAmountAsLong;
private long tradePrice;
private String tradingPeerNodeAddress;
@ -254,11 +249,6 @@ public class TradeInfo implements Payload {
return this;
}
public TradeInfoBuilder withWithdrawalTxId(String withdrawalTxId) {
this.withdrawalTxId = withdrawalTxId;
return this;
}
public TradeInfoBuilder withTradeAmountAsLong(long tradeAmountAsLong) {
this.tradeAmountAsLong = tradeAmountAsLong;
return this;
@ -342,7 +332,6 @@ public class TradeInfo implements Payload {
", takerFeeTxId='" + takerFeeTxId + '\'' + "\n" +
", depositTxId='" + depositTxId + '\'' + "\n" +
", payoutTxId='" + payoutTxId + '\'' + "\n" +
", withdrawalTxId='" + withdrawalTxId + '\'' + "\n" +
", tradeAmountAsLong='" + tradeAmountAsLong + '\'' + "\n" +
", tradePrice='" + tradePrice + '\'' + "\n" +
", tradingPeerNodeAddress='" + tradingPeerNodeAddress + '\'' + "\n" +

View file

@ -317,10 +317,6 @@ public abstract class Trade implements Tradable, Model {
@Getter
@Setter
private String payoutTxId;
@Nullable
@Getter
@Setter
private String withdrawalTxId;
@Getter
@Setter
private long tradeAmountAsLong;
@ -558,7 +554,6 @@ public abstract class Trade implements Tradable, Model {
Optional.ofNullable(takerFeeTxId).ifPresent(builder::setTakerFeeTxId);
Optional.ofNullable(depositTxId).ifPresent(builder::setDepositTxId);
Optional.ofNullable(payoutTxId).ifPresent(builder::setPayoutTxId);
Optional.ofNullable(withdrawalTxId).ifPresent(builder::setWithdrawalTxId);
Optional.ofNullable(tradingPeerNodeAddress).ifPresent(e -> builder.setTradingPeerNodeAddress(tradingPeerNodeAddress.toProtoMessage()));
Optional.ofNullable(contract).ifPresent(e -> builder.setContract(contract.toProtoMessage()));
Optional.ofNullable(contractAsJson).ifPresent(builder::setContractAsJson);
@ -592,7 +587,6 @@ public abstract class Trade implements Tradable, Model {
trade.setTakerFeeTxId(ProtoUtil.stringOrNullFromProto(proto.getTakerFeeTxId()));
trade.setDepositTxId(ProtoUtil.stringOrNullFromProto(proto.getDepositTxId()));
trade.setPayoutTxId(ProtoUtil.stringOrNullFromProto(proto.getPayoutTxId()));
trade.setWithdrawalTxId(ProtoUtil.stringOrNullFromProto(proto.getWithdrawalTxId()));
trade.setContract(proto.hasContract() ? Contract.fromProto(proto.getContract(), coreProtoResolver) : null);
trade.setContractAsJson(ProtoUtil.stringOrNullFromProto(proto.getContractAsJson()));
trade.setContractHash(ProtoUtil.byteArrayOrNullFromProto(proto.getContractHash()));
@ -1130,7 +1124,6 @@ public abstract class Trade implements Tradable, Model {
",\n takerFeeTxId='" + takerFeeTxId + '\'' +
",\n depositTxId='" + depositTxId + '\'' +
",\n payoutTxId='" + payoutTxId + '\'' +
",\n withdrawalTxId='" + withdrawalTxId + '\'' +
",\n tradeAmountAsLong=" + tradeAmountAsLong +
",\n tradePrice=" + tradePrice +
",\n tradingPeerNodeAddress=" + tradingPeerNodeAddress +

View file

@ -497,7 +497,6 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
onTradeCompleted(trade);
trade.setState(Trade.State.WITHDRAW_COMPLETED);
getTradeProtocol(trade).onWithdrawCompleted();
trade.setWithdrawalTxId(transaction.getTxId().toString());
requestPersistence();
resultHandler.handleResult();
}

View file

@ -273,20 +273,19 @@ message TradeInfo {
string takerFeeTxId = 9;
string depositTxId = 10;
string payoutTxId = 11;
string withdrawalTxId = 12;
uint64 tradeAmountAsLong = 13;
uint64 tradePrice = 14;
string tradingPeerNodeAddress = 15;
string state = 16;
string phase = 17;
string tradePeriodState = 18;
bool isDepositPublished = 19;
bool isDepositConfirmed = 20;
bool isFiatSent = 21;
bool isFiatReceived = 22;
bool isPayoutPublished = 23;
bool isWithdrawn = 24;
string contractAsJson = 25;
uint64 tradeAmountAsLong = 12;
uint64 tradePrice = 13;
string tradingPeerNodeAddress = 14;
string state = 15;
string phase = 16;
string tradePeriodState = 17;
bool isDepositPublished = 18;
bool isDepositConfirmed = 19;
bool isFiatSent = 20;
bool isFiatReceived = 21;
bool isPayoutPublished = 22;
bool isWithdrawn = 23;
string contractAsJson = 24;
}
///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -1450,7 +1450,6 @@ message Trade {
string counter_currency_extra_data = 37;
string asset_tx_proof_result = 38; // name of AssetTxProofResult enum
string uid = 39;
string withdrawal_tx_id = 40;
}
message BuyerAsMakerTrade {