From 8bce0e815720a2cc6d7d58f89d59f49d35e3b55c Mon Sep 17 00:00:00 2001 From: m52go Date: Wed, 29 Jul 2020 14:46:18 -0400 Subject: [PATCH 01/17] Refresh strings: Shared --- .../resources/i18n/displayStrings.properties | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index a6a1154e78..e0082bcbf6 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -35,7 +35,7 @@ shared.no=No shared.iUnderstand=I understand shared.na=N/A shared.shutDown=Shut down -shared.reportBug=Report bug at GitHub issues +shared.reportBug=Report bug on GitHub shared.buyBitcoin=Buy bitcoin shared.sellBitcoin=Sell bitcoin shared.buyCurrency=Buy {0} @@ -94,21 +94,21 @@ shared.BTCMinMax=BTC (min - max) shared.removeOffer=Remove offer shared.dontRemoveOffer=Don't remove offer shared.editOffer=Edit offer -shared.openLargeQRWindow=Open large QR-Code window +shared.openLargeQRWindow=Open large QR code window shared.tradingAccount=Trading account -shared.faq=Visit FAQ web page +shared.faq=Visit FAQ page shared.yesCancel=Yes, cancel shared.nextStep=Next step shared.selectTradingAccount=Select trading account shared.fundFromSavingsWalletButton=Transfer funds from Bisq wallet shared.fundFromExternalWalletButton=Open your external wallet for funding -shared.openDefaultWalletFailed=Opening a default Bitcoin wallet application has failed. Perhaps you don't have one installed? +shared.openDefaultWalletFailed=Failed to open a Bitcoin wallet application. Are you sure you have one installed? shared.distanceInPercent=Distance in % from market price shared.belowInPercent=Below % from market price shared.aboveInPercent=Above % from market price shared.enterPercentageValue=Enter % value shared.OR=OR -shared.notEnoughFunds=You don''t have enough funds in your Bisq wallet.\nYou need {0} but you have only {1} in your Bisq wallet.\n\nPlease fund the trade from an external Bitcoin wallet or fund your Bisq wallet at \"Funds/Receive funds\". +shared.notEnoughFunds=You don''t have enough funds in your Bisq wallet for this transaction—{0} is needed but only {1} is available.\n\nPlease add funds from an external wallet, or fund your Bisq wallet at Funds > Receive Funds. shared.waitingForFunds=Waiting for funds... shared.depositTransactionId=Deposit transaction ID shared.TheBTCBuyer=The BTC buyer @@ -116,22 +116,22 @@ shared.You=You shared.reasonForPayment=Reason for payment shared.sendingConfirmation=Sending confirmation... shared.sendingConfirmationAgain=Please send confirmation again -shared.exportCSV=Export to csv +shared.exportCSV=Export to CSV shared.exportJSON=Export to JSON shared.noDateAvailable=No date available shared.noDetailsAvailable=No details available shared.notUsedYet=Not used yet shared.date=Date shared.sendFundsDetailsWithFee=Sending: {0}\nFrom address: {1}\nTo receiving address: {2}.\nRequired mining fee is: {3} ({4} satoshis/byte)\nTransaction size: {5} Kb\n\nThe recipient will receive: {6}\n\nAre you sure you want to withdraw this amount? -shared.sendFundsDetailsDust=Bisq detected that this transaction would create a change output which is below the minimum dust threshold (and not allowed by Bitcoin consensus rules). Instead, this dust ({0} satoshi{1}) will be added to the mining fee.\n\n\n +shared.sendFundsDetailsDust=Bisq detected that this transaction would create a change output which is below the minimum dust threshold (and therefore not allowed by Bitcoin consensus rules). Instead, this dust ({0} satoshi{1}) will be added to the mining fee.\n\n\n shared.copyToClipboard=Copy to clipboard shared.language=Language shared.country=Country shared.applyAndShutDown=Apply and shut down shared.selectPaymentMethod=Select payment method -shared.accountNameAlreadyUsed=That account name is already used in a saved account.\nPlease use another name. +shared.accountNameAlreadyUsed=That account name is already used for another saved account.\nPlease choose another name. shared.askConfirmDeleteAccount=Do you really want to delete the selected account? -shared.cannotDeleteAccount=You cannot delete that account because it is used in an open offer or in a trade. +shared.cannotDeleteAccount=You cannot delete that account because it is being used in an open offer (or in an open trade). shared.noAccountsSetupYet=There are no accounts set up yet shared.manageAccounts=Manage accounts shared.addNewAccount=Add new account @@ -376,10 +376,10 @@ offerbook.deactivateOffer.failed=Deactivating of offer failed:\n{0} offerbook.activateOffer.failed=Publishing of offer failed:\n{0} offerbook.withdrawFundsHint=You can withdraw the funds you paid in from the {0} screen. -offerbook.warning.noTradingAccountForCurrency.headline=No trading account for selected currency -offerbook.warning.noTradingAccountForCurrency.msg=You don't have a trading account for the selected currency.\nDo you want to create an offer with one of your existing trading accounts? -offerbook.warning.noMatchingAccount.headline=No matching trading account. -offerbook.warning.noMatchingAccount.msg=To take this offer, you will need to set up a payment account using this payment method.\n\nWould you like to do this now? +offerbook.warning.noTradingAccountForCurrency.headline=No payment account for selected currency +offerbook.warning.noTradingAccountForCurrency.msg=You don't have a payment account set up for the selected currency.\n\nWould you like to create an offer for another currency instead? +offerbook.warning.noMatchingAccount.headline=No matching payment account. +offerbook.warning.noMatchingAccount.msg=This offer uses a payment method you haven't set up yet. \n\nWould you like to set up a new payment account now? offerbook.warning.counterpartyTradeRestrictions=This offer cannot be taken due to counterparty trade restrictions @@ -2454,8 +2454,8 @@ offerDetailsWindow.confirm.taker=Confirm: Take offer to {0} bitcoin offerDetailsWindow.creationDate=Creation date offerDetailsWindow.makersOnion=Maker's onion address -qRCodeWindow.headline=QR-Code -qRCodeWindow.msg=Please use that QR-Code for funding your Bisq wallet from your external wallet. +qRCodeWindow.headline=QR Code +qRCodeWindow.msg=Please use this QR code for funding your Bisq wallet from your external wallet. qRCodeWindow.request=Payment request:\n{0} selectDepositTxWindow.headline=Select deposit transaction for dispute @@ -2789,8 +2789,8 @@ systemTray.tooltip=Bisq: A decentralized bitcoin exchange network # GUI Util #################################################################### -guiUtil.miningFeeInfo=Please be sure that the mining fee used at your external wallet is \ -at least {0} satoshis/byte. Otherwise the trade transactions cannot be confirmed and a trade would end up in a dispute. +guiUtil.miningFeeInfo=Please be sure that the mining fee used by your external wallet is \ +at least {0} satoshis/byte. Otherwise the trade transactions may not be confirmed in time and the trade will end up in a dispute. guiUtil.accountExport.savedToPath=Trading accounts saved to path:\n{0} guiUtil.accountExport.noAccountSetup=You don't have trading accounts set up for exporting. From 359037a3ba9358282b9cf6ba687656a809a4a78a Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Mon, 14 Sep 2020 10:43:31 -0300 Subject: [PATCH 02/17] Move version service proto def to bottom of grpc.proto --- proto/src/main/proto/grpc.proto | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/proto/src/main/proto/grpc.proto b/proto/src/main/proto/grpc.proto index 730920b062..234b5e7762 100644 --- a/proto/src/main/proto/grpc.proto +++ b/proto/src/main/proto/grpc.proto @@ -23,22 +23,6 @@ import "pb.proto"; option java_package = "bisq.proto.grpc"; option java_multiple_files = true; -/////////////////////////////////////////////////////////////////////////////////////////// -// Version -/////////////////////////////////////////////////////////////////////////////////////////// - -service GetVersion { - rpc GetVersion (GetVersionRequest) returns (GetVersionReply) { - } -} - -message GetVersionRequest { -} - -message GetVersionReply { - string version = 1; -} - /////////////////////////////////////////////////////////////////////////////////////////// // Offers /////////////////////////////////////////////////////////////////////////////////////////// @@ -214,3 +198,20 @@ message AddressBalanceInfo { int64 balance = 2; int64 numConfirmations = 3; } + +/////////////////////////////////////////////////////////////////////////////////////////// +// Version +/////////////////////////////////////////////////////////////////////////////////////////// + +service GetVersion { + rpc GetVersion (GetVersionRequest) returns (GetVersionReply) { + } +} + +message GetVersionRequest { +} + +message GetVersionReply { + string version = 1; +} + From 15b60445873304e614be6d9ba20c9e86181f6cba Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Mon, 14 Sep 2020 10:44:19 -0300 Subject: [PATCH 03/17] Add dispute agents service proto def to grpc.proto --- proto/src/main/proto/grpc.proto | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/proto/src/main/proto/grpc.proto b/proto/src/main/proto/grpc.proto index 234b5e7762..ed2cb4fd61 100644 --- a/proto/src/main/proto/grpc.proto +++ b/proto/src/main/proto/grpc.proto @@ -23,6 +23,23 @@ import "pb.proto"; option java_package = "bisq.proto.grpc"; option java_multiple_files = true; +/////////////////////////////////////////////////////////////////////////////////////////// +// DisputeAgents +/////////////////////////////////////////////////////////////////////////////////////////// + +service DisputeAgents { + rpc RegisterDisputeAgent (RegisterDisputeAgentRequest) returns (RegisterDisputeAgentReply) { + } +} + +message RegisterDisputeAgentRequest { + string disputeAgentType = 1; + string registrationKey = 2; +} + +message RegisterDisputeAgentReply { +} + /////////////////////////////////////////////////////////////////////////////////////////// // Offers /////////////////////////////////////////////////////////////////////////////////////////// From bbf4f09181746759961f5404f241fa183dd6c5ec Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Mon, 14 Sep 2020 11:04:10 -0300 Subject: [PATCH 04/17] Add core impl for registering dispute agents This change supports registering mediators and refund agents on daemons running on regest or testnet chains. Registering arbitrators is not supported. --- core/src/main/java/bisq/core/api/CoreApi.java | 14 +- .../core/api/CoreDisputeAgentsService.java | 145 ++++++++++++++++++ .../daemon/grpc/GrpcDisputeAgentsService.java | 45 ++++++ 3 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 core/src/main/java/bisq/core/api/CoreDisputeAgentsService.java create mode 100644 daemon/src/main/java/bisq/daemon/grpc/GrpcDisputeAgentsService.java diff --git a/core/src/main/java/bisq/core/api/CoreApi.java b/core/src/main/java/bisq/core/api/CoreApi.java index 30cedeb3b9..35af589f3d 100644 --- a/core/src/main/java/bisq/core/api/CoreApi.java +++ b/core/src/main/java/bisq/core/api/CoreApi.java @@ -47,26 +47,38 @@ import lombok.extern.slf4j.Slf4j; @Slf4j public class CoreApi { + private final CoreDisputeAgentsService coreDisputeAgentsService; private final CoreOffersService coreOffersService; private final CorePaymentAccountsService paymentAccountsService; private final CoreWalletsService walletsService; private final TradeStatisticsManager tradeStatisticsManager; @Inject - public CoreApi(CoreOffersService coreOffersService, + public CoreApi(CoreDisputeAgentsService coreDisputeAgentsService, + CoreOffersService coreOffersService, CorePaymentAccountsService paymentAccountsService, CoreWalletsService walletsService, TradeStatisticsManager tradeStatisticsManager) { + this.coreDisputeAgentsService = coreDisputeAgentsService; this.coreOffersService = coreOffersService; this.paymentAccountsService = paymentAccountsService; this.walletsService = walletsService; this.tradeStatisticsManager = tradeStatisticsManager; } + @SuppressWarnings("SameReturnValue") public String getVersion() { return Version.VERSION; } + /////////////////////////////////////////////////////////////////////////////////////////// + // Dispute Agents + /////////////////////////////////////////////////////////////////////////////////////////// + + public void registerDisputeAgent(String disputeAgentType, String registrationKey) { + coreDisputeAgentsService.registerDisputeAgent(disputeAgentType, registrationKey); + } + /////////////////////////////////////////////////////////////////////////////////////////// // Offers /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/core/src/main/java/bisq/core/api/CoreDisputeAgentsService.java b/core/src/main/java/bisq/core/api/CoreDisputeAgentsService.java new file mode 100644 index 0000000000..a1071ab3b2 --- /dev/null +++ b/core/src/main/java/bisq/core/api/CoreDisputeAgentsService.java @@ -0,0 +1,145 @@ +/* + * This file is part of Bisq. + * + * Bisq is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Bisq is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Bisq. If not, see . + */ + +package bisq.core.api; + +import bisq.core.support.dispute.mediation.mediator.Mediator; +import bisq.core.support.dispute.mediation.mediator.MediatorManager; +import bisq.core.support.dispute.refund.refundagent.RefundAgent; +import bisq.core.support.dispute.refund.refundagent.RefundAgentManager; + +import bisq.network.p2p.NodeAddress; +import bisq.network.p2p.P2PService; + +import bisq.common.config.Config; +import bisq.common.crypto.KeyRing; + +import org.bitcoinj.core.ECKey; + +import javax.inject.Inject; + +import java.net.InetAddress; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +import lombok.extern.slf4j.Slf4j; + +import static bisq.common.app.DevEnv.DEV_PRIVILEGE_PRIV_KEY; + +@Slf4j +class CoreDisputeAgentsService { + + private final Config config; + private final KeyRing keyRing; + private final MediatorManager mediatorManager; + private final RefundAgentManager refundAgentManager; + private final P2PService p2PService; + + @Inject + public CoreDisputeAgentsService(Config config, + KeyRing keyRing, + MediatorManager mediatorManager, + RefundAgentManager refundAgentManager, + P2PService p2PService) { + this.config = config; + this.keyRing = keyRing; + this.mediatorManager = mediatorManager; + this.refundAgentManager = refundAgentManager; + this.p2PService = p2PService; + } + + public void registerDisputeAgent(String disputeAgentType, String registrationKey) { + if (!p2PService.isBootstrapped()) + throw new IllegalStateException("p2p service is not bootstrapped yet"); + + if (config.baseCurrencyNetwork.isMainnet() + || config.baseCurrencyNetwork.isDaoBetaNet() + || !config.useLocalhostForP2P) + throw new IllegalStateException("dispute agents must be registered in a Bisq UI"); + + if (!registrationKey.equals(DEV_PRIVILEGE_PRIV_KEY)) + throw new IllegalArgumentException("invalid registration key"); + + switch (disputeAgentType) { + case "arbitrator": + throw new IllegalArgumentException("arbitrators must be registered in a Bisq UI"); + case "mediator": + case "refundagent": + NodeAddress nodeAddress = new NodeAddress( + InetAddress.getLoopbackAddress().getHostAddress(), config.nodePort); + List languageCodes = Arrays.asList("de", "en", "es", "fr"); + ECKey ecKey = mediatorManager.getRegistrationKey(registrationKey); + String signature = mediatorManager.signStorageSignaturePubKey(Objects.requireNonNull(ecKey)); + + if (disputeAgentType.equals("mediator")) + registerMediator(nodeAddress, languageCodes, ecKey, signature); + else + registerRefundAgent(nodeAddress, languageCodes, ecKey, signature); + + return; + default: + throw new IllegalArgumentException("unknown dispute agent type " + disputeAgentType); + } + } + + private void registerMediator(NodeAddress nodeAddress, + List languageCodes, + ECKey ecKey, + String signature) { + Mediator mediator = new Mediator( + nodeAddress, + keyRing.getPubKeyRing(), + languageCodes, + new Date().getTime(), + ecKey.getPubKey(), + signature, + null, + null, + null + ); + mediatorManager.addDisputeAgent(mediator, () -> { + }, errorMessage -> { + }); + mediatorManager.getDisputeAgentByNodeAddress(nodeAddress).orElseThrow(() -> + new IllegalStateException("could not register mediator")); + } + + private void registerRefundAgent(NodeAddress nodeAddress, + List languageCodes, + ECKey ecKey, + String signature) { + RefundAgent refundAgent = new RefundAgent( + nodeAddress, + keyRing.getPubKeyRing(), + languageCodes, + new Date().getTime(), + ecKey.getPubKey(), + signature, + null, + null, + null + ); + refundAgentManager.addDisputeAgent(refundAgent, () -> { + }, errorMessage -> { + }); + refundAgentManager.getDisputeAgentByNodeAddress(nodeAddress).orElseThrow(() -> + new IllegalStateException("could not register refund agent")); + } +} diff --git a/daemon/src/main/java/bisq/daemon/grpc/GrpcDisputeAgentsService.java b/daemon/src/main/java/bisq/daemon/grpc/GrpcDisputeAgentsService.java new file mode 100644 index 0000000000..24fd192fea --- /dev/null +++ b/daemon/src/main/java/bisq/daemon/grpc/GrpcDisputeAgentsService.java @@ -0,0 +1,45 @@ +package bisq.daemon.grpc; + +import bisq.core.api.CoreApi; + +import bisq.proto.grpc.DisputeAgentsGrpc; +import bisq.proto.grpc.RegisterDisputeAgentReply; +import bisq.proto.grpc.RegisterDisputeAgentRequest; + +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import io.grpc.stub.StreamObserver; + +import javax.inject.Inject; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +class GrpcDisputeAgentsService extends DisputeAgentsGrpc.DisputeAgentsImplBase { + + private final CoreApi coreApi; + + @Inject + public GrpcDisputeAgentsService(CoreApi coreApi) { + this.coreApi = coreApi; + } + + @Override + public void registerDisputeAgent(RegisterDisputeAgentRequest req, + StreamObserver responseObserver) { + try { + coreApi.registerDisputeAgent(req.getDisputeAgentType(), req.getRegistrationKey()); + var reply = RegisterDisputeAgentReply.newBuilder().build(); + responseObserver.onNext(reply); + responseObserver.onCompleted(); + } catch (IllegalArgumentException cause) { + var ex = new StatusRuntimeException(Status.INVALID_ARGUMENT.withDescription(cause.getMessage())); + responseObserver.onError(ex); + throw ex; + } catch (IllegalStateException cause) { + var ex = new StatusRuntimeException(Status.UNKNOWN.withDescription(cause.getMessage())); + responseObserver.onError(ex); + throw ex; + } + } +} From 3386b43e52de5a0eae01ac3612c63e422300d293 Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Mon, 14 Sep 2020 11:39:36 -0300 Subject: [PATCH 05/17] Add GrpcDisputeAgentsService to GrpcServer --- daemon/src/main/java/bisq/daemon/grpc/GrpcServer.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/daemon/src/main/java/bisq/daemon/grpc/GrpcServer.java b/daemon/src/main/java/bisq/daemon/grpc/GrpcServer.java index a1293dfa0a..0c0e2f5cb3 100644 --- a/daemon/src/main/java/bisq/daemon/grpc/GrpcServer.java +++ b/daemon/src/main/java/bisq/daemon/grpc/GrpcServer.java @@ -51,11 +51,13 @@ public class GrpcServer { @Inject public GrpcServer(Config config, CoreApi coreApi, + GrpcDisputeAgentsService disputeAgentsService, GrpcOffersService offersService, GrpcPaymentAccountsService paymentAccountsService, GrpcWalletsService walletsService) { this.coreApi = coreApi; this.server = ServerBuilder.forPort(config.apiPort) + .addService(disputeAgentsService) .addService(new GetVersionService()) .addService(new GetTradeStatisticsService()) .addService(offersService) From 304047eacaae2f95760d3b336a9d2affcc8bc4be Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Mon, 14 Sep 2020 11:40:22 -0300 Subject: [PATCH 06/17] Create GrpcDisputeAgentsService stub --- cli/src/main/java/bisq/cli/GrpcStubs.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli/src/main/java/bisq/cli/GrpcStubs.java b/cli/src/main/java/bisq/cli/GrpcStubs.java index e12a6efa7c..2ef5efb75b 100644 --- a/cli/src/main/java/bisq/cli/GrpcStubs.java +++ b/cli/src/main/java/bisq/cli/GrpcStubs.java @@ -17,6 +17,7 @@ package bisq.cli; +import bisq.proto.grpc.DisputeAgentsGrpc; import bisq.proto.grpc.GetVersionGrpc; import bisq.proto.grpc.OffersGrpc; import bisq.proto.grpc.PaymentAccountsGrpc; @@ -29,6 +30,7 @@ import static java.util.concurrent.TimeUnit.SECONDS; public class GrpcStubs { + public final DisputeAgentsGrpc.DisputeAgentsBlockingStub disputeAgentsService; public final GetVersionGrpc.GetVersionBlockingStub versionService; public final OffersGrpc.OffersBlockingStub offersService; public final PaymentAccountsGrpc.PaymentAccountsBlockingStub paymentAccountsService; @@ -46,6 +48,7 @@ public class GrpcStubs { } })); + this.disputeAgentsService = DisputeAgentsGrpc.newBlockingStub(channel).withCallCredentials(credentials); this.versionService = GetVersionGrpc.newBlockingStub(channel).withCallCredentials(credentials); this.offersService = OffersGrpc.newBlockingStub(channel).withCallCredentials(credentials); this.paymentAccountsService = PaymentAccountsGrpc.newBlockingStub(channel).withCallCredentials(credentials); From 899bea8df5cbd42e85a2ace4b61d2e9ebf2e709f Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Mon, 14 Sep 2020 11:53:02 -0300 Subject: [PATCH 07/17] Replace "localhost" strings with InetAddress.getLoopbackAddress calls --- .../main/java/bisq/apitest/config/ApiTestConfig.java | 4 +++- apitest/src/test/java/bisq/apitest/ApiTestCase.java | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/apitest/src/main/java/bisq/apitest/config/ApiTestConfig.java b/apitest/src/main/java/bisq/apitest/config/ApiTestConfig.java index 5197a35634..b0ce2c548e 100644 --- a/apitest/src/main/java/bisq/apitest/config/ApiTestConfig.java +++ b/apitest/src/main/java/bisq/apitest/config/ApiTestConfig.java @@ -27,6 +27,8 @@ import joptsimple.OptionParser; import joptsimple.OptionSet; import joptsimple.OptionSpec; +import java.net.InetAddress; + import java.nio.file.Paths; import java.io.File; @@ -169,7 +171,7 @@ public class ApiTestConfig { ArgumentAcceptingOptionSpec bitcoinRegtestHostOpt = parser.accepts(BITCOIN_REGTEST_HOST, "Bitcoin Core regtest host") .withRequiredArg() - .ofType(String.class).defaultsTo("localhost"); + .ofType(String.class).defaultsTo(InetAddress.getLoopbackAddress().getHostAddress()); ArgumentAcceptingOptionSpec bitcoinRpcPortOpt = parser.accepts(BITCOIN_RPC_PORT, "Bitcoin Core rpc port (non-default)") diff --git a/apitest/src/test/java/bisq/apitest/ApiTestCase.java b/apitest/src/test/java/bisq/apitest/ApiTestCase.java index f9100bee96..3001c5b64d 100644 --- a/apitest/src/test/java/bisq/apitest/ApiTestCase.java +++ b/apitest/src/test/java/bisq/apitest/ApiTestCase.java @@ -17,6 +17,8 @@ package bisq.apitest; +import java.net.InetAddress; + import java.io.IOException; import java.util.concurrent.ExecutionException; @@ -69,16 +71,16 @@ public class ApiTestCase { scaffold = new Scaffold(supportingApps).setUp(); config = scaffold.config; bitcoinCli = new BitcoinCliHelper((config)); - // For now, all grpc requests are sent to the alicedaemon, but this will need to - // be made configurable for new test cases that call arb or bob node daemons. - grpcStubs = new GrpcStubs("localhost", alicedaemon.apiPort, config.apiPassword); + grpcStubs = new GrpcStubs(InetAddress.getLoopbackAddress().getHostAddress(), + alicedaemon.apiPort, config.apiPassword); } public static void setUpScaffold(String[] params) throws InterruptedException, ExecutionException, IOException { scaffold = new Scaffold(params).setUp(); config = scaffold.config; - grpcStubs = new GrpcStubs("localhost", alicedaemon.apiPort, config.apiPassword); + grpcStubs = new GrpcStubs(InetAddress.getLoopbackAddress().getHostAddress(), + alicedaemon.apiPort, config.apiPassword); } public static void tearDownScaffold() { From 148a0f120015e6923a5bc517aa114c879467a384 Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Mon, 14 Sep 2020 12:09:04 -0300 Subject: [PATCH 08/17] Refactor test cases to use arbitrary grpc stubs Most test cases send requests to the alicedaemon, but new test cases will need to be able to send requests to arbitration and bob daemons. --- .../test/java/bisq/apitest/ApiTestCase.java | 25 ++++++--- .../bisq/apitest/method/GetBalanceTest.java | 4 +- .../bisq/apitest/method/GetVersionTest.java | 3 +- .../java/bisq/apitest/method/MethodTest.java | 27 +++++++--- .../apitest/method/WalletProtectionTest.java | 51 +++++++++---------- .../scenario/FundWalletScenarioTest.java | 8 +-- 6 files changed, 70 insertions(+), 48 deletions(-) diff --git a/apitest/src/test/java/bisq/apitest/ApiTestCase.java b/apitest/src/test/java/bisq/apitest/ApiTestCase.java index 3001c5b64d..30e7472e2a 100644 --- a/apitest/src/test/java/bisq/apitest/ApiTestCase.java +++ b/apitest/src/test/java/bisq/apitest/ApiTestCase.java @@ -21,14 +21,16 @@ import java.net.InetAddress; import java.io.IOException; +import java.util.HashMap; +import java.util.Map; import java.util.concurrent.ExecutionException; -import static bisq.apitest.config.BisqAppConfig.alicedaemon; import static java.util.concurrent.TimeUnit.MILLISECONDS; import bisq.apitest.config.ApiTestConfig; +import bisq.apitest.config.BisqAppConfig; import bisq.apitest.method.BitcoinCliHelper; import bisq.cli.GrpcStubs; @@ -59,34 +61,41 @@ import bisq.cli.GrpcStubs; */ public class ApiTestCase { - // The gRPC service stubs are used by method & scenario tests, but not e2e tests. - protected static GrpcStubs grpcStubs; - protected static Scaffold scaffold; protected static ApiTestConfig config; protected static BitcoinCliHelper bitcoinCli; + // gRPC service stubs are used by method & scenario tests, but not e2e tests. + private static final Map grpcStubsCache = new HashMap<>(); + public static void setUpScaffold(String supportingApps) throws InterruptedException, ExecutionException, IOException { scaffold = new Scaffold(supportingApps).setUp(); config = scaffold.config; bitcoinCli = new BitcoinCliHelper((config)); - grpcStubs = new GrpcStubs(InetAddress.getLoopbackAddress().getHostAddress(), - alicedaemon.apiPort, config.apiPassword); } public static void setUpScaffold(String[] params) throws InterruptedException, ExecutionException, IOException { scaffold = new Scaffold(params).setUp(); config = scaffold.config; - grpcStubs = new GrpcStubs(InetAddress.getLoopbackAddress().getHostAddress(), - alicedaemon.apiPort, config.apiPassword); } public static void tearDownScaffold() { scaffold.tearDown(); } + protected static GrpcStubs grpcStubs(BisqAppConfig bisqAppConfig) { + if (grpcStubsCache.containsKey(bisqAppConfig)) { + return grpcStubsCache.get(bisqAppConfig); + } else { + GrpcStubs stubs = new GrpcStubs(InetAddress.getLoopbackAddress().getHostAddress(), + bisqAppConfig.apiPort, config.apiPassword); + grpcStubsCache.put(bisqAppConfig, stubs); + return stubs; + } + } + protected void sleep(long ms) { try { MILLISECONDS.sleep(ms); diff --git a/apitest/src/test/java/bisq/apitest/method/GetBalanceTest.java b/apitest/src/test/java/bisq/apitest/method/GetBalanceTest.java index 2cf4e8ae1c..a77fe633ea 100644 --- a/apitest/src/test/java/bisq/apitest/method/GetBalanceTest.java +++ b/apitest/src/test/java/bisq/apitest/method/GetBalanceTest.java @@ -27,6 +27,7 @@ import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; +import static bisq.apitest.config.BisqAppConfig.alicedaemon; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; @@ -57,7 +58,8 @@ public class GetBalanceTest extends MethodTest { public void testGetBalance() { // All tests depend on the DAO / regtest environment, and Alice's wallet is // initialized with 10 BTC during the scaffolding setup. - var balance = grpcStubs.walletsService.getBalance(GetBalanceRequest.newBuilder().build()).getBalance(); + var balance = grpcStubs(alicedaemon).walletsService + .getBalance(GetBalanceRequest.newBuilder().build()).getBalance(); assertEquals(1000000000, balance); } diff --git a/apitest/src/test/java/bisq/apitest/method/GetVersionTest.java b/apitest/src/test/java/bisq/apitest/method/GetVersionTest.java index 22413cf9d3..ed6083c8d3 100644 --- a/apitest/src/test/java/bisq/apitest/method/GetVersionTest.java +++ b/apitest/src/test/java/bisq/apitest/method/GetVersionTest.java @@ -50,7 +50,8 @@ public class GetVersionTest extends MethodTest { @Test @Order(1) public void testGetVersion() { - var version = grpcStubs.versionService.getVersion(GetVersionRequest.newBuilder().build()).getVersion(); + var version = grpcStubs(alicedaemon).versionService + .getVersion(GetVersionRequest.newBuilder().build()).getVersion(); assertEquals(VERSION, version); } diff --git a/apitest/src/test/java/bisq/apitest/method/MethodTest.java b/apitest/src/test/java/bisq/apitest/method/MethodTest.java index 694aa6806e..3437ac59c9 100644 --- a/apitest/src/test/java/bisq/apitest/method/MethodTest.java +++ b/apitest/src/test/java/bisq/apitest/method/MethodTest.java @@ -20,13 +20,17 @@ package bisq.apitest.method; import bisq.proto.grpc.GetBalanceRequest; import bisq.proto.grpc.GetFundingAddressesRequest; import bisq.proto.grpc.LockWalletRequest; +import bisq.proto.grpc.RegisterDisputeAgentRequest; import bisq.proto.grpc.RemoveWalletPasswordRequest; import bisq.proto.grpc.SetWalletPasswordRequest; import bisq.proto.grpc.UnlockWalletRequest; +import static bisq.common.app.DevEnv.DEV_PRIVILEGE_PRIV_KEY; + import bisq.apitest.ApiTestCase; +import bisq.apitest.config.BisqAppConfig; public class MethodTest extends ApiTestCase { @@ -60,24 +64,31 @@ public class MethodTest extends ApiTestCase { return GetFundingAddressesRequest.newBuilder().build(); } + protected final RegisterDisputeAgentRequest createRegisterDisputeAgentRequest(String disputeAgentType) { + return RegisterDisputeAgentRequest.newBuilder() + .setDisputeAgentType(disputeAgentType) + .setRegistrationKey(DEV_PRIVILEGE_PRIV_KEY).build(); + } + // Convenience methods for calling frequently used & thoroughly tested gRPC services. - protected final long getBalance() { - return grpcStubs.walletsService.getBalance(createBalanceRequest()).getBalance(); + protected final long getBalance(BisqAppConfig bisqAppConfig) { + return grpcStubs(bisqAppConfig).walletsService.getBalance(createBalanceRequest()).getBalance(); } - protected final void unlockWallet(String password, long timeout) { + protected final void unlockWallet(BisqAppConfig bisqAppConfig, String password, long timeout) { //noinspection ResultOfMethodCallIgnored - grpcStubs.walletsService.unlockWallet(createUnlockWalletRequest(password, timeout)); + grpcStubs(bisqAppConfig).walletsService.unlockWallet(createUnlockWalletRequest(password, timeout)); } - protected final void lockWallet() { + protected final void lockWallet(BisqAppConfig bisqAppConfig) { //noinspection ResultOfMethodCallIgnored - grpcStubs.walletsService.lockWallet(createLockWalletRequest()); + grpcStubs(bisqAppConfig).walletsService.lockWallet(createLockWalletRequest()); } - protected final String getUnusedBtcAddress() { - return grpcStubs.walletsService.getFundingAddresses(createGetFundingAddressesRequest()) + protected final String getUnusedBtcAddress(BisqAppConfig bisqAppConfig) { + //noinspection OptionalGetWithoutIsPresent + return grpcStubs(bisqAppConfig).walletsService.getFundingAddresses(createGetFundingAddressesRequest()) .getAddressBalanceInfoList() .stream() .filter(a -> a.getBalance() == 0 && a.getNumConfirmations() == 0) diff --git a/apitest/src/test/java/bisq/apitest/method/WalletProtectionTest.java b/apitest/src/test/java/bisq/apitest/method/WalletProtectionTest.java index 450fb58e01..f74c8e705c 100644 --- a/apitest/src/test/java/bisq/apitest/method/WalletProtectionTest.java +++ b/apitest/src/test/java/bisq/apitest/method/WalletProtectionTest.java @@ -36,13 +36,13 @@ public class WalletProtectionTest extends MethodTest { @Order(1) public void testSetWalletPassword() { var request = createSetWalletPasswordRequest("first-password"); - grpcStubs.walletsService.setWalletPassword(request); + grpcStubs(alicedaemon).walletsService.setWalletPassword(request); } @Test @Order(2) public void testGetBalanceOnEncryptedWalletShouldThrowException() { - Throwable exception = assertThrows(StatusRuntimeException.class, this::getBalance); + Throwable exception = assertThrows(StatusRuntimeException.class, () -> getBalance(alicedaemon)); assertEquals("UNKNOWN: wallet is locked", exception.getMessage()); } @@ -50,11 +50,10 @@ public class WalletProtectionTest extends MethodTest { @Order(3) public void testUnlockWalletFor4Seconds() { var request = createUnlockWalletRequest("first-password", 4); - grpcStubs.walletsService.unlockWallet(request); - getBalance(); // should not throw 'wallet locked' exception - + grpcStubs(alicedaemon).walletsService.unlockWallet(request); + getBalance(alicedaemon); // should not throw 'wallet locked' exception sleep(4500); // let unlock timeout expire - Throwable exception = assertThrows(StatusRuntimeException.class, this::getBalance); + Throwable exception = assertThrows(StatusRuntimeException.class, () -> getBalance(alicedaemon)); assertEquals("UNKNOWN: wallet is locked", exception.getMessage()); } @@ -62,20 +61,19 @@ public class WalletProtectionTest extends MethodTest { @Order(4) public void testGetBalanceAfterUnlockTimeExpiryShouldThrowException() { var request = createUnlockWalletRequest("first-password", 3); - grpcStubs.walletsService.unlockWallet(request); + grpcStubs(alicedaemon).walletsService.unlockWallet(request); sleep(4000); // let unlock timeout expire - Throwable exception = assertThrows(StatusRuntimeException.class, this::getBalance); + Throwable exception = assertThrows(StatusRuntimeException.class, () -> getBalance(alicedaemon)); assertEquals("UNKNOWN: wallet is locked", exception.getMessage()); } @Test @Order(5) public void testLockWalletBeforeUnlockTimeoutExpiry() { - unlockWallet("first-password", 60); + unlockWallet(alicedaemon, "first-password", 60); var request = createLockWalletRequest(); - grpcStubs.walletsService.lockWallet(request); - - Throwable exception = assertThrows(StatusRuntimeException.class, this::getBalance); + grpcStubs(alicedaemon).walletsService.lockWallet(request); + Throwable exception = assertThrows(StatusRuntimeException.class, () -> getBalance(alicedaemon)); assertEquals("UNKNOWN: wallet is locked", exception.getMessage()); } @@ -83,40 +81,39 @@ public class WalletProtectionTest extends MethodTest { @Order(6) public void testLockWalletWhenWalletAlreadyLockedShouldThrowException() { var request = createLockWalletRequest(); - Throwable exception = assertThrows(StatusRuntimeException.class, () -> - grpcStubs.walletsService.lockWallet(request)); + grpcStubs(alicedaemon).walletsService.lockWallet(request)); assertEquals("UNKNOWN: wallet is already locked", exception.getMessage()); } @Test @Order(7) public void testUnlockWalletTimeoutOverride() { - unlockWallet("first-password", 2); + unlockWallet(alicedaemon, "first-password", 2); sleep(500); // override unlock timeout after 0.5s - unlockWallet("first-password", 6); + unlockWallet(alicedaemon, "first-password", 6); sleep(5000); - getBalance(); // getbalance 5s after resetting unlock timeout to 6s + getBalance(alicedaemon); // getbalance 5s after resetting unlock timeout to 6s } @Test @Order(8) public void testSetNewWalletPassword() { - var request = createSetWalletPasswordRequest("first-password", "second-password"); - grpcStubs.walletsService.setWalletPassword(request); - - unlockWallet("second-password", 2); - getBalance(); + var request = createSetWalletPasswordRequest( + "first-password", "second-password"); + grpcStubs(alicedaemon).walletsService.setWalletPassword(request); + unlockWallet(alicedaemon, "second-password", 2); + getBalance(alicedaemon); sleep(2500); // allow time for wallet save } @Test @Order(9) public void testSetNewWalletPasswordWithIncorrectNewPasswordShouldThrowException() { - var request = createSetWalletPasswordRequest("bad old password", "irrelevant"); - + var request = createSetWalletPasswordRequest( + "bad old password", "irrelevant"); Throwable exception = assertThrows(StatusRuntimeException.class, () -> - grpcStubs.walletsService.setWalletPassword(request)); + grpcStubs(alicedaemon).walletsService.setWalletPassword(request)); assertEquals("UNKNOWN: incorrect old password", exception.getMessage()); } @@ -124,8 +121,8 @@ public class WalletProtectionTest extends MethodTest { @Order(10) public void testRemoveNewWalletPassword() { var request = createRemoveWalletPasswordRequest("second-password"); - grpcStubs.walletsService.removeWalletPassword(request); - getBalance(); // should not throw 'wallet locked' exception + grpcStubs(alicedaemon).walletsService.removeWalletPassword(request); + getBalance(alicedaemon); // should not throw 'wallet locked' exception } @AfterAll diff --git a/apitest/src/test/java/bisq/apitest/scenario/FundWalletScenarioTest.java b/apitest/src/test/java/bisq/apitest/scenario/FundWalletScenarioTest.java index e95e310eb5..0b30d72c1c 100644 --- a/apitest/src/test/java/bisq/apitest/scenario/FundWalletScenarioTest.java +++ b/apitest/src/test/java/bisq/apitest/scenario/FundWalletScenarioTest.java @@ -26,6 +26,7 @@ import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; +import static bisq.apitest.config.BisqAppConfig.alicedaemon; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; @@ -48,16 +49,17 @@ public class FundWalletScenarioTest extends ScenarioTest { @Test @Order(1) public void testFundWallet() { - long balance = getBalance(); // bisq wallet was initialized with 10 btc + // bisq wallet was initialized with 10 btc + long balance = getBalance(alicedaemon); assertEquals(1000000000, balance); - String unusedAddress = getUnusedBtcAddress(); + String unusedAddress = getUnusedBtcAddress(alicedaemon); bitcoinCli.sendToAddress(unusedAddress, "2.5"); bitcoinCli.generateBlocks(1); sleep(1500); - balance = getBalance(); + balance = getBalance(alicedaemon); assertEquals(1250000000L, balance); // new balance is 12.5 btc } From 8384dd80049a5e1f05212e78b15551eb2c3f81e1 Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Mon, 14 Sep 2020 12:13:36 -0300 Subject: [PATCH 09/17] Add api dispute agent registration test case This test case checks that mediators and refund agents can be registered over grpc, but not on mainnet. --- .../method/RegisterDisputeAgentsTest.java | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 apitest/src/test/java/bisq/apitest/method/RegisterDisputeAgentsTest.java diff --git a/apitest/src/test/java/bisq/apitest/method/RegisterDisputeAgentsTest.java b/apitest/src/test/java/bisq/apitest/method/RegisterDisputeAgentsTest.java new file mode 100644 index 0000000000..1ad3a36f16 --- /dev/null +++ b/apitest/src/test/java/bisq/apitest/method/RegisterDisputeAgentsTest.java @@ -0,0 +1,108 @@ +/* + * This file is part of Bisq. + * + * Bisq is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Bisq is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Bisq. If not, see . + */ + +package bisq.apitest.method; + +import bisq.proto.grpc.RegisterDisputeAgentRequest; + +import io.grpc.StatusRuntimeException; + +import lombok.extern.slf4j.Slf4j; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; + +import static bisq.apitest.config.BisqAppConfig.arbdaemon; +import static bisq.common.app.DevEnv.DEV_PRIVILEGE_PRIV_KEY; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.jupiter.api.MethodOrderer.OrderAnnotation; + + +@SuppressWarnings("ResultOfMethodCallIgnored") +@Slf4j +@TestMethodOrder(OrderAnnotation.class) +public class RegisterDisputeAgentsTest extends MethodTest { + + @BeforeAll + public static void setUp() { + try { + setUpScaffold("bitcoind,seednode,arbdaemon"); + } catch (Exception ex) { + fail(ex); + } + } + + @Test + @Order(1) + public void testRegisterArbitratorShouldThrowException() { + var req = + createRegisterDisputeAgentRequest("arbitrator"); + Throwable exception = assertThrows(StatusRuntimeException.class, () -> + grpcStubs(arbdaemon).disputeAgentsService.registerDisputeAgent(req)); + assertEquals("INVALID_ARGUMENT: arbitrators must be registered in a Bisq UI", + exception.getMessage()); + } + + @Test + @Order(2) + public void testInvalidDisputeAgentTypeArgShouldThrowException() { + var req = + createRegisterDisputeAgentRequest("badagent"); + Throwable exception = assertThrows(StatusRuntimeException.class, () -> + grpcStubs(arbdaemon).disputeAgentsService.registerDisputeAgent(req)); + assertEquals("INVALID_ARGUMENT: unknown dispute agent type badagent", + exception.getMessage()); + } + + @Test + @Order(3) + public void testInvalidRegistrationKeyArgShouldThrowException() { + var req = RegisterDisputeAgentRequest.newBuilder() + .setDisputeAgentType("refundagent") + .setRegistrationKey("invalid" + DEV_PRIVILEGE_PRIV_KEY).build(); + Throwable exception = assertThrows(StatusRuntimeException.class, () -> + grpcStubs(arbdaemon).disputeAgentsService.registerDisputeAgent(req)); + assertEquals("INVALID_ARGUMENT: invalid registration key", + exception.getMessage()); + } + + @Test + @Order(4) + public void testRegisterMediator() { + var req = + createRegisterDisputeAgentRequest("mediator"); + grpcStubs(arbdaemon).disputeAgentsService.registerDisputeAgent(req); + } + + @Test + @Order(5) + public void testRegisterRefundAgent() { + var req = + createRegisterDisputeAgentRequest("refundagent"); + grpcStubs(arbdaemon).disputeAgentsService.registerDisputeAgent(req); + } + + @AfterAll + public static void tearDown() { + tearDownScaffold(); + } +} From 3f0394f722904c3130a36ef60740197dbb68cb88 Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Mon, 14 Sep 2020 12:14:37 -0300 Subject: [PATCH 10/17] Bump version to 1.3.8 --- apitest/scripts/mainnet-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apitest/scripts/mainnet-test.sh b/apitest/scripts/mainnet-test.sh index ae3afd73d2..9c5889ff3a 100755 --- a/apitest/scripts/mainnet-test.sh +++ b/apitest/scripts/mainnet-test.sh @@ -48,14 +48,14 @@ run ./bisq-cli --password="xyz" getversion [ "$status" -eq 0 ] echo "actual output: $output" >&2 - [ "$output" = "1.3.7" ] + [ "$output" = "1.3.8" ] } @test "test getversion" { run ./bisq-cli --password=xyz getversion [ "$status" -eq 0 ] echo "actual output: $output" >&2 - [ "$output" = "1.3.7" ] + [ "$output" = "1.3.8" ] } @test "test setwalletpassword \"a b c\"" { From 71d57298b000585a9370dfc3afe72dc997c750fe Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Mon, 14 Sep 2020 16:05:47 -0500 Subject: [PATCH 11/17] Add try/catch at setSuggestedSecurityDeposit code --- .../main/offer/MutableOfferDataModel.java | 63 ++++++++++--------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java index 5660336062..feb85be9e3 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java @@ -335,37 +335,42 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs private void setSuggestedSecurityDeposit(PaymentAccount paymentAccount) { var minSecurityDeposit = preferences.getBuyerSecurityDepositAsPercent(getPaymentAccount()); - if (getTradeCurrency() == null) { - setBuyerSecurityDeposit(minSecurityDeposit, false); - return; - } - // Get average historic prices over for the prior trade period equaling the lock time - var blocksRange = Restrictions.getLockTime(paymentAccount.getPaymentMethod().isAsset()); - var startDate = new Date(System.currentTimeMillis() - blocksRange * 10 * 60000); - var sortedRangeData = tradeStatisticsManager.getObservableTradeStatisticsSet().stream() - .filter(e -> e.getCurrencyCode().equals(getTradeCurrency().getCode())) - .filter(e -> e.getTradeDate().compareTo(startDate) >= 0) - .sorted(Comparator.comparing(TradeStatistics2::getTradeDate)) - .collect(Collectors.toList()); - var movingAverage = new MathUtils.MovingAverage(10, 0.2); - double[] extremes = {Double.MAX_VALUE, Double.MIN_VALUE}; - sortedRangeData.forEach(e -> { - var price = e.getTradePrice().getValue(); - movingAverage.next(price).ifPresent(val -> { - if (val < extremes[0]) extremes[0] = val; - if (val > extremes[1]) extremes[1] = val; + try { + if (getTradeCurrency() == null) { + setBuyerSecurityDeposit(minSecurityDeposit, false); + return; + } + // Get average historic prices over for the prior trade period equaling the lock time + var blocksRange = Restrictions.getLockTime(paymentAccount.getPaymentMethod().isAsset()); + var startDate = new Date(System.currentTimeMillis() - blocksRange * 10 * 60000); + var sortedRangeData = tradeStatisticsManager.getObservableTradeStatisticsSet().stream() + .filter(e -> e.getCurrencyCode().equals(getTradeCurrency().getCode())) + .filter(e -> e.getTradeDate().compareTo(startDate) >= 0) + .sorted(Comparator.comparing(TradeStatistics2::getTradeDate)) + .collect(Collectors.toList()); + var movingAverage = new MathUtils.MovingAverage(10, 0.2); + double[] extremes = {Double.MAX_VALUE, Double.MIN_VALUE}; + sortedRangeData.forEach(e -> { + var price = e.getTradePrice().getValue(); + movingAverage.next(price).ifPresent(val -> { + if (val < extremes[0]) extremes[0] = val; + if (val > extremes[1]) extremes[1] = val; + }); }); - }); - var min = extremes[0]; - var max = extremes[1]; - if (min == 0d || max == 0d) { - setBuyerSecurityDeposit(minSecurityDeposit, false); - return; + var min = extremes[0]; + var max = extremes[1]; + if (min == 0d || max == 0d) { + setBuyerSecurityDeposit(minSecurityDeposit, false); + return; + } + // Suggested deposit is double the trade range over the previous lock time period, bounded by min/max deposit + var suggestedSecurityDeposit = + Math.min(2 * (max - min) / max, Restrictions.getMaxBuyerSecurityDepositAsPercent()); + buyerSecurityDeposit.set(Math.max(suggestedSecurityDeposit, minSecurityDeposit)); + } catch (Throwable t) { + log.error(t.toString()); + buyerSecurityDeposit.set(minSecurityDeposit); } - // Suggested deposit is double the trade range over the previous lock time period, bounded by min/max deposit - var suggestedSecurityDeposit = - Math.min(2 * (max - min) / max, Restrictions.getMaxBuyerSecurityDepositAsPercent()); - buyerSecurityDeposit.set(Math.max(suggestedSecurityDeposit, minSecurityDeposit)); } From 70d98d955402fd32b19a0e30742107d9a9142c13 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Mon, 14 Sep 2020 16:06:52 -0500 Subject: [PATCH 12/17] Ensure the division is not by 0 and add try catch to MovingAverage --- .../main/java/bisq/common/util/MathUtils.java | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/common/src/main/java/bisq/common/util/MathUtils.java b/common/src/main/java/bisq/common/util/MathUtils.java index 6de3011a42..08f6d55b53 100644 --- a/common/src/main/java/bisq/common/util/MathUtils.java +++ b/common/src/main/java/bisq/common/util/MathUtils.java @@ -29,6 +29,8 @@ import java.util.Optional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static com.google.common.base.Preconditions.checkArgument; + public class MathUtils { private static final Logger log = LoggerFactory.getLogger(MathUtils.class); @@ -127,24 +129,30 @@ public class MathUtils { } public Optional next(long val) { - var fullAtStart = isFull(); - if (fullAtStart) { - if (outlier > 0) { - // Return early if it's an outlier - var avg = (double) sum / size; - if (Math.abs(avg - val) / avg > outlier) { - return Optional.empty(); + try { + var fullAtStart = isFull(); + if (fullAtStart) { + if (outlier > 0) { + // Return early if it's an outlier + checkArgument(size != 0); + var avg = (double) sum / size; + if (Math.abs(avg - val) / avg > outlier) { + return Optional.empty(); + } } + sum -= window.remove(); } - sum -= window.remove(); + window.add(val); + sum += val; + if (!fullAtStart && isFull() && outlier != 0) { + removeInitialOutlier(); + } + // When discarding outliers, the first n non discarded elements return Optional.empty() + return outlier > 0 && !isFull() ? Optional.empty() : current(); + } catch (Throwable t) { + log.error(t.toString()); + return Optional.empty(); } - window.add(val); - sum += val; - if (!fullAtStart && isFull() && outlier != 0) { - removeInitialOutlier(); - } - // When discarding outliers, the first n non discarded elements return Optional.empty() - return outlier > 0 && !isFull() ? Optional.empty() : current(); } boolean isFull() { @@ -155,7 +163,9 @@ public class MathUtils { var element = window.iterator(); while (element.hasNext()) { var val = element.next(); - var avgExVal = (double) (sum - val) / (size - 1); + int div = size - 1; + checkArgument(div != 0); + var avgExVal = (double) (sum - val) / div; if (Math.abs(avgExVal - val) / avgExVal > outlier) { element.remove(); break; From 601de7890d7e2c256389790485189d9f3c92a978 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Mon, 14 Sep 2020 16:05:47 -0500 Subject: [PATCH 13/17] Add try/catch at setSuggestedSecurityDeposit code --- .../main/offer/MutableOfferDataModel.java | 63 ++++++++++--------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java index 5660336062..feb85be9e3 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java @@ -335,37 +335,42 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs private void setSuggestedSecurityDeposit(PaymentAccount paymentAccount) { var minSecurityDeposit = preferences.getBuyerSecurityDepositAsPercent(getPaymentAccount()); - if (getTradeCurrency() == null) { - setBuyerSecurityDeposit(minSecurityDeposit, false); - return; - } - // Get average historic prices over for the prior trade period equaling the lock time - var blocksRange = Restrictions.getLockTime(paymentAccount.getPaymentMethod().isAsset()); - var startDate = new Date(System.currentTimeMillis() - blocksRange * 10 * 60000); - var sortedRangeData = tradeStatisticsManager.getObservableTradeStatisticsSet().stream() - .filter(e -> e.getCurrencyCode().equals(getTradeCurrency().getCode())) - .filter(e -> e.getTradeDate().compareTo(startDate) >= 0) - .sorted(Comparator.comparing(TradeStatistics2::getTradeDate)) - .collect(Collectors.toList()); - var movingAverage = new MathUtils.MovingAverage(10, 0.2); - double[] extremes = {Double.MAX_VALUE, Double.MIN_VALUE}; - sortedRangeData.forEach(e -> { - var price = e.getTradePrice().getValue(); - movingAverage.next(price).ifPresent(val -> { - if (val < extremes[0]) extremes[0] = val; - if (val > extremes[1]) extremes[1] = val; + try { + if (getTradeCurrency() == null) { + setBuyerSecurityDeposit(minSecurityDeposit, false); + return; + } + // Get average historic prices over for the prior trade period equaling the lock time + var blocksRange = Restrictions.getLockTime(paymentAccount.getPaymentMethod().isAsset()); + var startDate = new Date(System.currentTimeMillis() - blocksRange * 10 * 60000); + var sortedRangeData = tradeStatisticsManager.getObservableTradeStatisticsSet().stream() + .filter(e -> e.getCurrencyCode().equals(getTradeCurrency().getCode())) + .filter(e -> e.getTradeDate().compareTo(startDate) >= 0) + .sorted(Comparator.comparing(TradeStatistics2::getTradeDate)) + .collect(Collectors.toList()); + var movingAverage = new MathUtils.MovingAverage(10, 0.2); + double[] extremes = {Double.MAX_VALUE, Double.MIN_VALUE}; + sortedRangeData.forEach(e -> { + var price = e.getTradePrice().getValue(); + movingAverage.next(price).ifPresent(val -> { + if (val < extremes[0]) extremes[0] = val; + if (val > extremes[1]) extremes[1] = val; + }); }); - }); - var min = extremes[0]; - var max = extremes[1]; - if (min == 0d || max == 0d) { - setBuyerSecurityDeposit(minSecurityDeposit, false); - return; + var min = extremes[0]; + var max = extremes[1]; + if (min == 0d || max == 0d) { + setBuyerSecurityDeposit(minSecurityDeposit, false); + return; + } + // Suggested deposit is double the trade range over the previous lock time period, bounded by min/max deposit + var suggestedSecurityDeposit = + Math.min(2 * (max - min) / max, Restrictions.getMaxBuyerSecurityDepositAsPercent()); + buyerSecurityDeposit.set(Math.max(suggestedSecurityDeposit, minSecurityDeposit)); + } catch (Throwable t) { + log.error(t.toString()); + buyerSecurityDeposit.set(minSecurityDeposit); } - // Suggested deposit is double the trade range over the previous lock time period, bounded by min/max deposit - var suggestedSecurityDeposit = - Math.min(2 * (max - min) / max, Restrictions.getMaxBuyerSecurityDepositAsPercent()); - buyerSecurityDeposit.set(Math.max(suggestedSecurityDeposit, minSecurityDeposit)); } From f6cb7c66964b3a503f5ef74ae11f7e101af8b2a6 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Mon, 14 Sep 2020 16:06:52 -0500 Subject: [PATCH 14/17] Ensure the division is not by 0 and add try catch to MovingAverage --- .../main/java/bisq/common/util/MathUtils.java | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/common/src/main/java/bisq/common/util/MathUtils.java b/common/src/main/java/bisq/common/util/MathUtils.java index 6de3011a42..08f6d55b53 100644 --- a/common/src/main/java/bisq/common/util/MathUtils.java +++ b/common/src/main/java/bisq/common/util/MathUtils.java @@ -29,6 +29,8 @@ import java.util.Optional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static com.google.common.base.Preconditions.checkArgument; + public class MathUtils { private static final Logger log = LoggerFactory.getLogger(MathUtils.class); @@ -127,24 +129,30 @@ public class MathUtils { } public Optional next(long val) { - var fullAtStart = isFull(); - if (fullAtStart) { - if (outlier > 0) { - // Return early if it's an outlier - var avg = (double) sum / size; - if (Math.abs(avg - val) / avg > outlier) { - return Optional.empty(); + try { + var fullAtStart = isFull(); + if (fullAtStart) { + if (outlier > 0) { + // Return early if it's an outlier + checkArgument(size != 0); + var avg = (double) sum / size; + if (Math.abs(avg - val) / avg > outlier) { + return Optional.empty(); + } } + sum -= window.remove(); } - sum -= window.remove(); + window.add(val); + sum += val; + if (!fullAtStart && isFull() && outlier != 0) { + removeInitialOutlier(); + } + // When discarding outliers, the first n non discarded elements return Optional.empty() + return outlier > 0 && !isFull() ? Optional.empty() : current(); + } catch (Throwable t) { + log.error(t.toString()); + return Optional.empty(); } - window.add(val); - sum += val; - if (!fullAtStart && isFull() && outlier != 0) { - removeInitialOutlier(); - } - // When discarding outliers, the first n non discarded elements return Optional.empty() - return outlier > 0 && !isFull() ? Optional.empty() : current(); } boolean isFull() { @@ -155,7 +163,9 @@ public class MathUtils { var element = window.iterator(); while (element.hasNext()) { var val = element.next(); - var avgExVal = (double) (sum - val) / (size - 1); + int div = size - 1; + checkArgument(div != 0); + var avgExVal = (double) (sum - val) / div; if (Math.abs(avgExVal - val) / avgExVal > outlier) { element.remove(); break; From 06ac7a76051fc174bda08fab9cee3166edaf8c72 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Wed, 16 Sep 2020 15:58:58 +0200 Subject: [PATCH 15/17] Bump version number for v1.3.9 --- build.gradle | 2 +- common/src/main/java/bisq/common/app/Version.java | 2 +- desktop/package/linux/Dockerfile | 2 +- desktop/package/linux/package.sh | 2 +- desktop/package/linux/release.sh | 2 +- desktop/package/macosx/Info.plist | 4 ++-- desktop/package/macosx/create_app.sh | 2 +- desktop/package/macosx/finalize.sh | 2 +- desktop/package/macosx/insert_snapshot_version.sh | 2 +- desktop/package/macosx/replace_version_number.sh | 4 ++-- desktop/package/windows/package.bat | 2 +- desktop/package/windows/release.bat | 2 +- relay/src/main/resources/version.txt | 2 +- seednode/src/main/java/bisq/seednode/SeedNodeMain.java | 2 +- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index 932644c115..8d8ddc770b 100644 --- a/build.gradle +++ b/build.gradle @@ -376,7 +376,7 @@ configure(project(':desktop')) { apply plugin: 'witness' apply from: '../gradle/witness/gradle-witness.gradle' - version = '1.3.8' + version = '1.3.9' mainClassName = 'bisq.desktop.app.BisqAppMain' diff --git a/common/src/main/java/bisq/common/app/Version.java b/common/src/main/java/bisq/common/app/Version.java index 898228f3de..0e4d7ce811 100644 --- a/common/src/main/java/bisq/common/app/Version.java +++ b/common/src/main/java/bisq/common/app/Version.java @@ -27,7 +27,7 @@ public class Version { // VERSION = 0.5.0 introduces proto buffer for the P2P network and local DB and is a not backward compatible update // Therefore all sub versions start again with 1 // We use semantic versioning with major, minor and patch - public static final String VERSION = "1.3.8"; + public static final String VERSION = "1.3.9"; public static int getMajorVersion(String version) { return getSubVersion(version, 0); diff --git a/desktop/package/linux/Dockerfile b/desktop/package/linux/Dockerfile index 1838bc7a53..c6458115aa 100644 --- a/desktop/package/linux/Dockerfile +++ b/desktop/package/linux/Dockerfile @@ -8,7 +8,7 @@ # pull base image FROM openjdk:8-jdk -ENV version 1.3.8 +ENV version 1.3.9 RUN apt-get update && apt-get install -y --no-install-recommends openjfx && rm -rf /var/lib/apt/lists/* && apt-get install -y vim fakeroot diff --git a/desktop/package/linux/package.sh b/desktop/package/linux/package.sh index 0e39599054..afc4009fe3 100755 --- a/desktop/package/linux/package.sh +++ b/desktop/package/linux/package.sh @@ -6,7 +6,7 @@ # - Update version below # - Ensure JAVA_HOME below is pointing to OracleJDK 10 directory -version=1.3.8 +version=1.3.9 version_base=$(echo $version | awk -F'[_-]' '{print $1}') if [ ! -f "$JAVA_HOME/bin/javapackager" ]; then if [ -d "/usr/lib/jvm/jdk-10.0.2" ]; then diff --git a/desktop/package/linux/release.sh b/desktop/package/linux/release.sh index 3ba92885a0..c3f3911101 100755 --- a/desktop/package/linux/release.sh +++ b/desktop/package/linux/release.sh @@ -4,7 +4,7 @@ # Prior to running this script: # - Update version below -version=1.3.8 +version=1.3.9 base_dir=$( cd "$(dirname "$0")" ; pwd -P )/../../.. package_dir=$base_dir/desktop/package release_dir=$base_dir/desktop/release/$version diff --git a/desktop/package/macosx/Info.plist b/desktop/package/macosx/Info.plist index bcdbedce14..b0f6d5a678 100644 --- a/desktop/package/macosx/Info.plist +++ b/desktop/package/macosx/Info.plist @@ -5,10 +5,10 @@ CFBundleVersion - 1.3.8 + 1.3.9 CFBundleShortVersionString - 1.3.8 + 1.3.9 CFBundleExecutable Bisq diff --git a/desktop/package/macosx/create_app.sh b/desktop/package/macosx/create_app.sh index 57b0cb4bda..c1cd9f2fc8 100755 --- a/desktop/package/macosx/create_app.sh +++ b/desktop/package/macosx/create_app.sh @@ -6,7 +6,7 @@ mkdir -p deploy set -e -version="1.3.8" +version="1.3.9" cd .. ./gradlew :desktop:build -x test shadowJar diff --git a/desktop/package/macosx/finalize.sh b/desktop/package/macosx/finalize.sh index 59df06eaa1..3cf62de8d3 100755 --- a/desktop/package/macosx/finalize.sh +++ b/desktop/package/macosx/finalize.sh @@ -2,7 +2,7 @@ cd ../../ -version="1.3.8" +version="1.3.9" target_dir="releases/$version" diff --git a/desktop/package/macosx/insert_snapshot_version.sh b/desktop/package/macosx/insert_snapshot_version.sh index 4e214a5581..26551709c3 100755 --- a/desktop/package/macosx/insert_snapshot_version.sh +++ b/desktop/package/macosx/insert_snapshot_version.sh @@ -2,7 +2,7 @@ cd $(dirname $0)/../../../ -version=1.3.7 +version=1.3.8 find . -type f \( -name "finalize.sh" \ -o -name "create_app.sh" \ diff --git a/desktop/package/macosx/replace_version_number.sh b/desktop/package/macosx/replace_version_number.sh index 33f30a5440..ce7486313c 100755 --- a/desktop/package/macosx/replace_version_number.sh +++ b/desktop/package/macosx/replace_version_number.sh @@ -2,8 +2,8 @@ cd $(dirname $0)/../../../ -oldVersion=1.3.7 -newVersion=1.3.8 +oldVersion=1.3.8 +newVersion=1.3.9 find . -type f \( -name "finalize.sh" \ -o -name "create_app.sh" \ diff --git a/desktop/package/windows/package.bat b/desktop/package/windows/package.bat index 7f4787f5a9..31f5e3fdc1 100644 --- a/desktop/package/windows/package.bat +++ b/desktop/package/windows/package.bat @@ -11,7 +11,7 @@ @echo off -set version=1.3.8 +set version=1.3.9 if not exist "%JAVA_HOME%\bin\javapackager.exe" ( if not exist "%ProgramFiles%\Java\jdk-10.0.2" ( echo Javapackager not found. Update JAVA_HOME variable to point to OracleJDK. diff --git a/desktop/package/windows/release.bat b/desktop/package/windows/release.bat index f6b98fbc5f..f76f9ddf48 100644 --- a/desktop/package/windows/release.bat +++ b/desktop/package/windows/release.bat @@ -6,7 +6,7 @@ @echo off -set version=1.3.8 +set version=1.3.9 set release_dir=%~dp0..\..\..\releases\%version% set package_dir=%~dp0.. diff --git a/relay/src/main/resources/version.txt b/relay/src/main/resources/version.txt index e05cb3329c..d4c4950a37 100644 --- a/relay/src/main/resources/version.txt +++ b/relay/src/main/resources/version.txt @@ -1 +1 @@ -1.3.8 +1.3.9 diff --git a/seednode/src/main/java/bisq/seednode/SeedNodeMain.java b/seednode/src/main/java/bisq/seednode/SeedNodeMain.java index ffa6ac667e..e5d85573aa 100644 --- a/seednode/src/main/java/bisq/seednode/SeedNodeMain.java +++ b/seednode/src/main/java/bisq/seednode/SeedNodeMain.java @@ -33,7 +33,7 @@ import lombok.extern.slf4j.Slf4j; @Slf4j public class SeedNodeMain extends ExecutableForAppWithP2p { - private static final String VERSION = "1.3.8"; + private static final String VERSION = "1.3.9"; private SeedNode seedNode; public SeedNodeMain() { From 57423f4fdb16a8720ff245c44ac1126bd0ba8079 Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Wed, 16 Sep 2020 11:14:30 -0300 Subject: [PATCH 16/17] Refactor to fix dispute agent mgr usage --- .../core/api/CoreDisputeAgentsService.java | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/core/src/main/java/bisq/core/api/CoreDisputeAgentsService.java b/core/src/main/java/bisq/core/api/CoreDisputeAgentsService.java index a1071ab3b2..29e51b8853 100644 --- a/core/src/main/java/bisq/core/api/CoreDisputeAgentsService.java +++ b/core/src/main/java/bisq/core/api/CoreDisputeAgentsService.java @@ -32,8 +32,6 @@ import org.bitcoinj.core.ECKey; import javax.inject.Inject; -import java.net.InetAddress; - import java.util.Arrays; import java.util.Date; import java.util.List; @@ -42,6 +40,7 @@ import java.util.Objects; import lombok.extern.slf4j.Slf4j; import static bisq.common.app.DevEnv.DEV_PRIVILEGE_PRIV_KEY; +import static java.net.InetAddress.getLoopbackAddress; @Slf4j class CoreDisputeAgentsService { @@ -51,6 +50,8 @@ class CoreDisputeAgentsService { private final MediatorManager mediatorManager; private final RefundAgentManager refundAgentManager; private final P2PService p2PService; + private final NodeAddress nodeAddress; + private final List languageCodes; @Inject public CoreDisputeAgentsService(Config config, @@ -63,6 +64,8 @@ class CoreDisputeAgentsService { this.mediatorManager = mediatorManager; this.refundAgentManager = refundAgentManager; this.p2PService = p2PService; + this.nodeAddress = new NodeAddress(getLoopbackAddress().getHostAddress(), config.nodePort); + this.languageCodes = Arrays.asList("de", "en", "es", "fr"); } public void registerDisputeAgent(String disputeAgentType, String registrationKey) { @@ -77,22 +80,20 @@ class CoreDisputeAgentsService { if (!registrationKey.equals(DEV_PRIVILEGE_PRIV_KEY)) throw new IllegalArgumentException("invalid registration key"); + ECKey ecKey; + String signature; switch (disputeAgentType) { case "arbitrator": throw new IllegalArgumentException("arbitrators must be registered in a Bisq UI"); case "mediator": + ecKey = mediatorManager.getRegistrationKey(registrationKey); + signature = mediatorManager.signStorageSignaturePubKey(Objects.requireNonNull(ecKey)); + registerMediator(nodeAddress, languageCodes, ecKey, signature); + return; case "refundagent": - NodeAddress nodeAddress = new NodeAddress( - InetAddress.getLoopbackAddress().getHostAddress(), config.nodePort); - List languageCodes = Arrays.asList("de", "en", "es", "fr"); - ECKey ecKey = mediatorManager.getRegistrationKey(registrationKey); - String signature = mediatorManager.signStorageSignaturePubKey(Objects.requireNonNull(ecKey)); - - if (disputeAgentType.equals("mediator")) - registerMediator(nodeAddress, languageCodes, ecKey, signature); - else - registerRefundAgent(nodeAddress, languageCodes, ecKey, signature); - + ecKey = refundAgentManager.getRegistrationKey(registrationKey); + signature = refundAgentManager.signStorageSignaturePubKey(Objects.requireNonNull(ecKey)); + registerRefundAgent(nodeAddress, languageCodes, ecKey, signature); return; default: throw new IllegalArgumentException("unknown dispute agent type " + disputeAgentType); @@ -103,8 +104,7 @@ class CoreDisputeAgentsService { List languageCodes, ECKey ecKey, String signature) { - Mediator mediator = new Mediator( - nodeAddress, + Mediator mediator = new Mediator(nodeAddress, keyRing.getPubKeyRing(), languageCodes, new Date().getTime(), @@ -125,8 +125,7 @@ class CoreDisputeAgentsService { List languageCodes, ECKey ecKey, String signature) { - RefundAgent refundAgent = new RefundAgent( - nodeAddress, + RefundAgent refundAgent = new RefundAgent(nodeAddress, keyRing.getPubKeyRing(), languageCodes, new Date().getTime(), From 95dd561d91c341bba2d913599e8cc61a972638fa Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Wed, 16 Sep 2020 16:49:48 +0200 Subject: [PATCH 17/17] Revert to SNAPSHOT version --- build.gradle | 2 +- desktop/package/linux/Dockerfile | 2 +- desktop/package/linux/package.sh | 2 +- desktop/package/linux/release.sh | 2 +- desktop/package/macosx/create_app.sh | 2 +- desktop/package/macosx/finalize.sh | 2 +- desktop/package/macosx/insert_snapshot_version.sh | 2 +- desktop/package/windows/package.bat | 2 +- desktop/package/windows/release.bat | 2 +- relay/src/main/resources/version.txt | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index 8d8ddc770b..532a111f90 100644 --- a/build.gradle +++ b/build.gradle @@ -376,7 +376,7 @@ configure(project(':desktop')) { apply plugin: 'witness' apply from: '../gradle/witness/gradle-witness.gradle' - version = '1.3.9' + version = '1.3.9-SNAPSHOT' mainClassName = 'bisq.desktop.app.BisqAppMain' diff --git a/desktop/package/linux/Dockerfile b/desktop/package/linux/Dockerfile index c6458115aa..5c8b4a7058 100644 --- a/desktop/package/linux/Dockerfile +++ b/desktop/package/linux/Dockerfile @@ -8,7 +8,7 @@ # pull base image FROM openjdk:8-jdk -ENV version 1.3.9 +ENV version 1.3.9-SNAPSHOT RUN apt-get update && apt-get install -y --no-install-recommends openjfx && rm -rf /var/lib/apt/lists/* && apt-get install -y vim fakeroot diff --git a/desktop/package/linux/package.sh b/desktop/package/linux/package.sh index afc4009fe3..8390f808f1 100755 --- a/desktop/package/linux/package.sh +++ b/desktop/package/linux/package.sh @@ -6,7 +6,7 @@ # - Update version below # - Ensure JAVA_HOME below is pointing to OracleJDK 10 directory -version=1.3.9 +version=1.3.9-SNAPSHOT version_base=$(echo $version | awk -F'[_-]' '{print $1}') if [ ! -f "$JAVA_HOME/bin/javapackager" ]; then if [ -d "/usr/lib/jvm/jdk-10.0.2" ]; then diff --git a/desktop/package/linux/release.sh b/desktop/package/linux/release.sh index c3f3911101..ae93fad673 100755 --- a/desktop/package/linux/release.sh +++ b/desktop/package/linux/release.sh @@ -4,7 +4,7 @@ # Prior to running this script: # - Update version below -version=1.3.9 +version=1.3.9-SNAPSHOT base_dir=$( cd "$(dirname "$0")" ; pwd -P )/../../.. package_dir=$base_dir/desktop/package release_dir=$base_dir/desktop/release/$version diff --git a/desktop/package/macosx/create_app.sh b/desktop/package/macosx/create_app.sh index c1cd9f2fc8..baa3515a7b 100755 --- a/desktop/package/macosx/create_app.sh +++ b/desktop/package/macosx/create_app.sh @@ -6,7 +6,7 @@ mkdir -p deploy set -e -version="1.3.9" +version="1.3.9-SNAPSHOT" cd .. ./gradlew :desktop:build -x test shadowJar diff --git a/desktop/package/macosx/finalize.sh b/desktop/package/macosx/finalize.sh index 3cf62de8d3..2c1916b17b 100755 --- a/desktop/package/macosx/finalize.sh +++ b/desktop/package/macosx/finalize.sh @@ -2,7 +2,7 @@ cd ../../ -version="1.3.9" +version="1.3.9-SNAPSHOT" target_dir="releases/$version" diff --git a/desktop/package/macosx/insert_snapshot_version.sh b/desktop/package/macosx/insert_snapshot_version.sh index 26551709c3..16879d6276 100755 --- a/desktop/package/macosx/insert_snapshot_version.sh +++ b/desktop/package/macosx/insert_snapshot_version.sh @@ -2,7 +2,7 @@ cd $(dirname $0)/../../../ -version=1.3.8 +version=1.3.9 find . -type f \( -name "finalize.sh" \ -o -name "create_app.sh" \ diff --git a/desktop/package/windows/package.bat b/desktop/package/windows/package.bat index 31f5e3fdc1..e535ebe2bd 100644 --- a/desktop/package/windows/package.bat +++ b/desktop/package/windows/package.bat @@ -11,7 +11,7 @@ @echo off -set version=1.3.9 +set version=1.3.9-SNAPSHOT if not exist "%JAVA_HOME%\bin\javapackager.exe" ( if not exist "%ProgramFiles%\Java\jdk-10.0.2" ( echo Javapackager not found. Update JAVA_HOME variable to point to OracleJDK. diff --git a/desktop/package/windows/release.bat b/desktop/package/windows/release.bat index f76f9ddf48..e49377c78c 100644 --- a/desktop/package/windows/release.bat +++ b/desktop/package/windows/release.bat @@ -6,7 +6,7 @@ @echo off -set version=1.3.9 +set version=1.3.9-SNAPSHOT set release_dir=%~dp0..\..\..\releases\%version% set package_dir=%~dp0.. diff --git a/relay/src/main/resources/version.txt b/relay/src/main/resources/version.txt index d4c4950a37..1610789efb 100644 --- a/relay/src/main/resources/version.txt +++ b/relay/src/main/resources/version.txt @@ -1 +1 @@ -1.3.9 +1.3.9-SNAPSHOT