From 3f2c79378f876869d78054f4d83f93d6397f53b5 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Tue, 5 Jul 2016 14:04:21 +0200 Subject: [PATCH 1/3] v 0.4.8.1 --- common/pom.xml | 2 +- common/src/main/java/io/bitsquare/app/Version.java | 2 +- core/pom.xml | 2 +- gui/pom.xml | 2 +- jsocks/pom.xml | 2 +- jtorctl/pom.xml | 2 +- jtorproxy/pom.xml | 2 +- network/pom.xml | 2 +- package/linux/create_32bit_app.sh | 2 +- package/linux/create_64bit_app.sh | 2 +- package/mac/create_app.sh | 2 +- package/mac/finalize.sh | 2 +- package/windows/Bitsquare.iss | 2 +- package/windows/create_32bit_app.bat | 2 +- package/windows/create_64bit_app.bat | 2 +- pom.xml | 2 +- seednode/pom.xml | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/common/pom.xml b/common/pom.xml index 879df3d8a5b..392d4f5cc4d 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ parent io.bitsquare - 0.4.8 + 0.4.8.1 4.0.0 diff --git a/common/src/main/java/io/bitsquare/app/Version.java b/common/src/main/java/io/bitsquare/app/Version.java index 416a8f88f37..3884fd241af 100644 --- a/common/src/main/java/io/bitsquare/app/Version.java +++ b/common/src/main/java/io/bitsquare/app/Version.java @@ -24,7 +24,7 @@ public class Version { private static final Logger log = LoggerFactory.getLogger(Version.class); // The application versions - public static final String VERSION = "0.4.8"; + public static final String VERSION = "0.4.8.1"; // The version nr. for the objects sent over the network. A change will break the serialization of old objects. // If objects are used for both network and database the network version is applied. diff --git a/core/pom.xml b/core/pom.xml index a7881fbf872..81cbb2d7853 100755 --- a/core/pom.xml +++ b/core/pom.xml @@ -6,7 +6,7 @@ parent io.bitsquare - 0.4.8 + 0.4.8.1 core diff --git a/gui/pom.xml b/gui/pom.xml index 695833a588a..b726bd26924 100644 --- a/gui/pom.xml +++ b/gui/pom.xml @@ -22,7 +22,7 @@ parent io.bitsquare - 0.4.8 + 0.4.8.1 4.0.0 diff --git a/jsocks/pom.xml b/jsocks/pom.xml index 20b15d65118..46c7a64e7c5 100644 --- a/jsocks/pom.xml +++ b/jsocks/pom.xml @@ -5,7 +5,7 @@ parent io.bitsquare - 0.4.8 + 0.4.8.1 4.0.0 diff --git a/jtorctl/pom.xml b/jtorctl/pom.xml index b1fe31ac7e0..975a47b12bb 100644 --- a/jtorctl/pom.xml +++ b/jtorctl/pom.xml @@ -5,7 +5,7 @@ parent io.bitsquare - 0.4.8 + 0.4.8.1 4.0.0 diff --git a/jtorproxy/pom.xml b/jtorproxy/pom.xml index 71e3ccb9039..9a6ce08f7e6 100644 --- a/jtorproxy/pom.xml +++ b/jtorproxy/pom.xml @@ -5,7 +5,7 @@ parent io.bitsquare - 0.4.8 + 0.4.8.1 4.0.0 diff --git a/network/pom.xml b/network/pom.xml index 376c542bbcd..dacfc1079c8 100644 --- a/network/pom.xml +++ b/network/pom.xml @@ -5,7 +5,7 @@ parent io.bitsquare - 0.4.8 + 0.4.8.1 4.0.0 diff --git a/package/linux/create_32bit_app.sh b/package/linux/create_32bit_app.sh index 6b1a9b8a0d4..98bd5228ddc 100644 --- a/package/linux/create_32bit_app.sh +++ b/package/linux/create_32bit_app.sh @@ -6,7 +6,7 @@ mkdir -p gui/deploy set -e # Edit versions -fullVersion=0.4.8 +fullVersion=0.4.8.1 jarFile="/home/bitsquare/Desktop/sf_vm_shared_ubuntu14_32bit/Bitsquare-$fullVersion.jar" # Note: fakeroot needs to be installed on linux diff --git a/package/linux/create_64bit_app.sh b/package/linux/create_64bit_app.sh index e305c3beea6..bc5496b3608 100644 --- a/package/linux/create_64bit_app.sh +++ b/package/linux/create_64bit_app.sh @@ -6,7 +6,7 @@ mkdir -p gui/deploy set -e # Edit versions -fullVersion=0.4.8 +fullVersion=0.4.8.1 jarFile="/home/mk/Desktop/sf_vm_shared_ubuntu/Bitsquare-$fullVersion.jar" # Note: fakeroot needs to be installed on linux diff --git a/package/mac/create_app.sh b/package/mac/create_app.sh index b28bd952f0b..da31920425c 100644 --- a/package/mac/create_app.sh +++ b/package/mac/create_app.sh @@ -5,7 +5,7 @@ mkdir -p gui/deploy set -e -fullVersion="0.4.8" +fullVersion="0.4.8.1" mvn clean package -DskipTests -Dmaven.javadoc.skip=true diff --git a/package/mac/finalize.sh b/package/mac/finalize.sh index 0c6078a2d65..42a62c385cf 100644 --- a/package/mac/finalize.sh +++ b/package/mac/finalize.sh @@ -1,6 +1,6 @@ #!/bin/bash -version="0.4.8" +version="0.4.8.1" target_dir="/Users/mk/Documents/__bitsquare/_releases/$version" diff --git a/package/windows/Bitsquare.iss b/package/windows/Bitsquare.iss index 6f77680fab8..bb43092e90e 100755 --- a/package/windows/Bitsquare.iss +++ b/package/windows/Bitsquare.iss @@ -3,7 +3,7 @@ [Setup] AppId={{bitsquare}} AppName=Bitsquare -AppVersion=0.4.8 +AppVersion=0.4.8.1 AppVerName=Bitsquare AppPublisher=Bitsquare AppComments=Bitsquare diff --git a/package/windows/create_32bit_app.bat b/package/windows/create_32bit_app.bat index 98d97107f95..e449522138f 100644 --- a/package/windows/create_32bit_app.bat +++ b/package/windows/create_32bit_app.bat @@ -8,6 +8,6 @@ mkdir gui\deploy :: 32 bit build :: Needs Inno Setup 5 or later (http://www.jrsoftware.org/isdl.php) -call "C:\Program Files\Java\jdk1.8.0_92\bin\javapackager.exe" -deploy -BappVersion=0.4.8 -native exe -name Bitsquare -title Bitsquare -vendor Bitsquare -outdir "\\VBOXSVR\vm_shared_windows_32bit" -appclass io.bitsquare.app.BitsquareAppMain -srcfiles "\\VBOXSVR\vm_shared_windows_32bit\Bitsquare-0.4.8.jar" -outfile Bitsquare -Bruntime="C:\Program Files\Java\jdk1.8.0_92\jre" -BjvmProperties=-Djava.net.preferIPv4Stack=true +call "C:\Program Files\Java\jdk1.8.0_92\bin\javapackager.exe" -deploy -BappVersion=0.4.8.1 -native exe -name Bitsquare -title Bitsquare -vendor Bitsquare -outdir "\\VBOXSVR\vm_shared_windows_32bit" -appclass io.bitsquare.app.BitsquareAppMain -srcfiles "\\VBOXSVR\vm_shared_windows_32bit\Bitsquare-0.4.8.1.jar" -outfile Bitsquare -Bruntime="C:\Program Files\Java\jdk1.8.0_92\jre" -BjvmProperties=-Djava.net.preferIPv4Stack=true cd package\windows \ No newline at end of file diff --git a/package/windows/create_64bit_app.bat b/package/windows/create_64bit_app.bat index 4bac9eda352..4021c59248b 100644 --- a/package/windows/create_64bit_app.bat +++ b/package/windows/create_64bit_app.bat @@ -8,6 +8,6 @@ mkdir gui\deploy :: 64 bit build :: Needs Inno Setup 5 or later (http://www.jrsoftware.org/isdl.php) -call "C:\Program Files\Java\jdk1.8.0_92\bin\javapackager.exe" -deploy -BappVersion=0.4.8 -native exe -name Bitsquare -title Bitsquare -vendor Bitsquare -outdir "\\VBOXSVR\vm_shared_windows" -appclass io.bitsquare.app.BitsquareAppMain -srcfiles "\\VBOXSVR\vm_shared_windows\Bitsquare-0.4.8.jar" -outfile Bitsquare -Bruntime="C:\Program Files\Java\jdk1.8.0_92\jre" -BjvmProperties=-Djava.net.preferIPv4Stack=true +call "C:\Program Files\Java\jdk1.8.0_92\bin\javapackager.exe" -deploy -BappVersion=0.4.8.1 -native exe -name Bitsquare -title Bitsquare -vendor Bitsquare -outdir "\\VBOXSVR\vm_shared_windows" -appclass io.bitsquare.app.BitsquareAppMain -srcfiles "\\VBOXSVR\vm_shared_windows\Bitsquare-0.4.8.1.jar" -outfile Bitsquare -Bruntime="C:\Program Files\Java\jdk1.8.0_92\jre" -BjvmProperties=-Djava.net.preferIPv4Stack=true cd package\windows \ No newline at end of file diff --git a/pom.xml b/pom.xml index 27e193f7005..bc220e2e186 100755 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.bitsquare parent pom - 0.4.8 + 0.4.8.1 Bitsquare - The decentralized bitcoin exchange https://bitsquare.io diff --git a/seednode/pom.xml b/seednode/pom.xml index 167b6a47722..909f531170b 100644 --- a/seednode/pom.xml +++ b/seednode/pom.xml @@ -5,7 +5,7 @@ parent io.bitsquare - 0.4.8 + 0.4.8.1 4.0.0 From f74ae1e0ff532fe77991f4abda8a53cc5662b71f Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Tue, 5 Jul 2016 14:08:46 +0200 Subject: [PATCH 2/3] Use bitcoinj 0.13.1.4 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bc220e2e186..58976c575cc 100755 --- a/pom.xml +++ b/pom.xml @@ -98,7 +98,7 @@ org.bitcoinj bitcoinj-core - 0.13.1.2 + 0.13.1.4 From b3dc95f9c8681dff523f555aded1e0e60fcd99ff Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Tue, 5 Jul 2016 14:28:25 +0200 Subject: [PATCH 3/3] Fix bug with multiple arbitrators --- .../arbitration/ArbitratorManager.java | 56 ++++++++++++------- .../src/main/java/io/bitsquare/user/User.java | 5 ++ .../ArbitratorSelectionViewModel.java | 2 +- .../gui/main/disputes/DisputesView.java | 2 +- 4 files changed, 42 insertions(+), 23 deletions(-) diff --git a/core/src/main/java/io/bitsquare/arbitration/ArbitratorManager.java b/core/src/main/java/io/bitsquare/arbitration/ArbitratorManager.java index 902538d96c7..bb0f24847ef 100644 --- a/core/src/main/java/io/bitsquare/arbitration/ArbitratorManager.java +++ b/core/src/main/java/io/bitsquare/arbitration/ArbitratorManager.java @@ -28,6 +28,7 @@ import io.bitsquare.p2p.P2PService; import io.bitsquare.p2p.storage.HashMapChangedListener; import io.bitsquare.p2p.storage.storageentry.ProtectedStorageEntry; +import io.bitsquare.user.Preferences; import io.bitsquare.user.User; import javafx.collections.FXCollections; import javafx.collections.ObservableMap; @@ -94,7 +95,9 @@ public class ArbitratorManager { private final KeyRing keyRing; private final ArbitratorService arbitratorService; private final User user; + private Preferences preferences; private final ObservableMap arbitratorsObservableMap = FXCollections.observableHashMap(); + private final List persistedAcceptedArbitrators; private Timer republishArbitratorTimer, retryRepublishArbitratorTimer; @@ -103,20 +106,26 @@ public class ArbitratorManager { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public ArbitratorManager(KeyRing keyRing, ArbitratorService arbitratorService, User user) { + public ArbitratorManager(KeyRing keyRing, ArbitratorService arbitratorService, User user, Preferences preferences) { this.keyRing = keyRing; this.arbitratorService = arbitratorService; this.user = user; + this.preferences = preferences; + + persistedAcceptedArbitrators = new ArrayList<>(user.getAcceptedArbitrators()); + user.clearAcceptedArbitrators(); arbitratorService.addHashSetChangedListener(new HashMapChangedListener() { @Override public void onAdded(ProtectedStorageEntry data) { - applyArbitrators(); + if (data.getStoragePayload() instanceof Arbitrator) + updateArbitratorMap(); } @Override public void onRemoved(ProtectedStorageEntry data) { - applyArbitrators(); + if (data.getStoragePayload() instanceof Arbitrator) + updateArbitratorMap(); } }); } @@ -145,7 +154,7 @@ public void onBootstrapComplete() { }); } - applyArbitrators(); + updateArbitratorMap(); } private void isBootstrapped() { @@ -156,9 +165,8 @@ private void isBootstrapped() { } } - public void applyArbitrators() { + public void updateArbitratorMap() { Map map = arbitratorService.getArbitrators(); - log.trace("Arbitrators . size=" + map.values().size()); arbitratorsObservableMap.clear(); Map filtered = map.values().stream() .filter(e -> isPublicKeyInList(Utils.HEX.encode(e.getRegistrationPubKey())) @@ -166,19 +174,25 @@ && verifySignature(e.getPubKeyRing().getSignaturePubKey(), e.getRegistrationPubK .collect(Collectors.toMap(Arbitrator::getArbitratorNodeAddress, Function.identity())); arbitratorsObservableMap.putAll(filtered); - // we need to remove accepted arbitrators which are not available anymore - if (user.getAcceptedArbitrators() != null) { - List removeList = user.getAcceptedArbitrators().stream() - .filter(e -> !arbitratorsObservableMap.containsValue(e)) - .collect(Collectors.toList()); - removeList.stream().forEach(user::removeAcceptedArbitrator); - - // if we don't have any arbitrator anymore we set all matching - if (user.getAcceptedArbitrators().isEmpty()) { - arbitratorsObservableMap.values().stream() - .filter(user::hasMatchingLanguage) - .forEach(user::addAcceptedArbitrator); - } + arbitratorsObservableMap.values().stream() + .filter(arbitrator -> persistedAcceptedArbitrators.contains(arbitrator)) + .forEach(user::addAcceptedArbitrator); + + if (preferences.getAutoSelectArbitrators()) { + arbitratorsObservableMap.values().stream() + .filter(user::hasMatchingLanguage) + .forEach(user::addAcceptedArbitrator); + } else { + // if we don't have any arbitrator we set all matching + // we use a delay as we might get our matching arbitrator a bit delayed (first we get one we did not selected + // then we get our selected one - we don't want to activate the first in that case) + UserThread.runAfter(() -> { + if (user.getAcceptedArbitrators().isEmpty()) { + arbitratorsObservableMap.values().stream() + .filter(user::hasMatchingLanguage) + .forEach(user::addAcceptedArbitrator); + } + }, 100, TimeUnit.MILLISECONDS); } } @@ -191,7 +205,7 @@ public void addArbitrator(Arbitrator arbitrator, ResultHandler resultHandler, Er resultHandler.handleResult(); if (arbitratorsObservableMap.size() > 0) - UserThread.runAfter(this::applyArbitrators, 100, TimeUnit.MILLISECONDS); + UserThread.runAfter(this::updateArbitratorMap, 100, TimeUnit.MILLISECONDS); }, errorMessageHandler::handleErrorMessage); } @@ -244,7 +258,7 @@ private void republishArbitrator() { Arbitrator registeredArbitrator = user.getRegisteredArbitrator(); if (registeredArbitrator != null) { addArbitrator(registeredArbitrator, - this::applyArbitrators, + this::updateArbitratorMap, errorMessage -> { if (retryRepublishArbitratorTimer == null) retryRepublishArbitratorTimer = UserThread.runPeriodically(() -> { diff --git a/core/src/main/java/io/bitsquare/user/User.java b/core/src/main/java/io/bitsquare/user/User.java index a7c86c0c52e..5ba43cd1014 100644 --- a/core/src/main/java/io/bitsquare/user/User.java +++ b/core/src/main/java/io/bitsquare/user/User.java @@ -272,6 +272,11 @@ public Arbitrator getAcceptedArbitratorByAddress(NodeAddress nodeAddress) { return null; } + public void clearAcceptedArbitrators() { + acceptedArbitrators.clear(); + storage.queueUpForSave(); + } + /////////////////////////////////////////////////////////////////////////////////////////// // Utils diff --git a/gui/src/main/java/io/bitsquare/gui/main/account/content/arbitratorselection/ArbitratorSelectionViewModel.java b/gui/src/main/java/io/bitsquare/gui/main/account/content/arbitratorselection/ArbitratorSelectionViewModel.java index e32ae3ddb54..391f1131557 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/account/content/arbitratorselection/ArbitratorSelectionViewModel.java +++ b/gui/src/main/java/io/bitsquare/gui/main/account/content/arbitratorselection/ArbitratorSelectionViewModel.java @@ -66,7 +66,7 @@ private void applyArbitratorMap() { protected void activate() { languageCodes.setAll(user.getAcceptedLanguageLocaleCodes()); arbitratorManager.getArbitratorsObservableMap().addListener(arbitratorMapChangeListener); - arbitratorManager.applyArbitrators(); + arbitratorManager.updateArbitratorMap(); applyArbitratorMap(); updateAutoSelectArbitrators(); diff --git a/gui/src/main/java/io/bitsquare/gui/main/disputes/DisputesView.java b/gui/src/main/java/io/bitsquare/gui/main/disputes/DisputesView.java index 45d236ab7be..83a3a868c8e 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/disputes/DisputesView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/disputes/DisputesView.java @@ -106,7 +106,7 @@ private void updateArbitratorsDisputesTabDisableState() { @Override protected void activate() { - arbitratorManager.applyArbitrators(); + arbitratorManager.updateArbitratorMap(); arbitratorManager.getArbitratorsObservableMap().addListener(arbitratorMapChangeListener); updateArbitratorsDisputesTabDisableState();