From 46a56e4e4f7dd9fbacf034f7882c6471142dacec Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Mon, 17 Nov 2014 18:57:58 +0100 Subject: [PATCH] Update to BitcoinJ 0.12.2 --- build.gradle | 2 +- src/main/java/io/bitsquare/btc/WalletService.java | 2 -- src/main/java/io/bitsquare/gui/util/BSFormatter.java | 4 +++- src/test/java/io/bitsquare/msg/TomP2PTests.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 3698ea3c08..d5339e386b 100644 --- a/build.gradle +++ b/build.gradle @@ -39,7 +39,7 @@ repositories { } dependencies { - compile 'org.bitcoinj:bitcoinj-core:0.12' + compile 'org.bitcoinj:bitcoinj-core:0.12.2' compile 'net.tomp2p:tomp2p-all:5.0-Alpha.8f1cafb-SNAPSHOT' compile 'org.springframework:spring-core:4.1.1.RELEASE' compile 'net.sf.jopt-simple:jopt-simple:4.8' diff --git a/src/main/java/io/bitsquare/btc/WalletService.java b/src/main/java/io/bitsquare/btc/WalletService.java index fcfb24a8db..ea75621223 100644 --- a/src/main/java/io/bitsquare/btc/WalletService.java +++ b/src/main/java/io/bitsquare/btc/WalletService.java @@ -364,13 +364,11 @@ public class WalletService { private AddressEntry getNewAddressEntry(AddressEntry.AddressContext addressContext, String offerId) { lock.lock(); - wallet.getLock().lock(); DeterministicKey key = wallet.freshReceiveKey(); AddressEntry addressEntry = new AddressEntry(key, params, addressContext, offerId); addressEntryList.add(addressEntry); saveAddressInfoList(); lock.unlock(); - wallet.getLock().unlock(); return addressEntry; } diff --git a/src/main/java/io/bitsquare/gui/util/BSFormatter.java b/src/main/java/io/bitsquare/gui/util/BSFormatter.java index b39c366086..8adbeba27a 100644 --- a/src/main/java/io/bitsquare/gui/util/BSFormatter.java +++ b/src/main/java/io/bitsquare/gui/util/BSFormatter.java @@ -29,6 +29,7 @@ import org.bitcoinj.utils.Fiat; import org.bitcoinj.utils.MonetaryFormat; import java.math.BigDecimal; +import java.math.RoundingMode; import java.text.DateFormat; import java.text.DecimalFormat; @@ -66,7 +67,8 @@ public class BSFormatter { // Input of a group separator (1,123,45) lead to an validation error. // Note: BtcFormat was intended to be used, but it lead to many problems (automatic format to mBit, // no way to remove grouping separator). It seems to be not optimal for user input formatting. - private MonetaryFormat coinFormat = MonetaryFormat.BTC.repeatOptionalDecimals(2, 1); + private MonetaryFormat coinFormat = MonetaryFormat.BTC.optionalDecimals(2) + .roundingMode(RoundingMode.HALF_UP); private String currencyCode = Currency.getInstance(Locale.getDefault()).getCurrencyCode(); diff --git a/src/test/java/io/bitsquare/msg/TomP2PTests.java b/src/test/java/io/bitsquare/msg/TomP2PTests.java index 51ffc9d4ce..7596eb5d23 100644 --- a/src/test/java/io/bitsquare/msg/TomP2PTests.java +++ b/src/test/java/io/bitsquare/msg/TomP2PTests.java @@ -85,7 +85,7 @@ public class TomP2PTests { private static final Logger log = LoggerFactory.getLogger(TomP2PTests.class); // If you want to test in one specific connection mode define it directly, otherwise use UNKNOWN - private static final ConnectionType FORCED_CONNECTION_TYPE = ConnectionType.MANUAL_PORT_FORWARDING; + private static final ConnectionType FORCED_CONNECTION_TYPE = ConnectionType.DIRECT; // Typically you run the bootstrap node in localhost to test direct connection. // If you have a setup where you are not behind a router you can also use a WAN bootstrap node.