From ec1fcad52eb026a43d53cd10ed31a75a3441edd5 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Fri, 15 Jan 2016 23:15:36 +0100 Subject: [PATCH] Reduce sec. deposit and max trade amount for mainnet --- .../main/java/io/bitsquare/btc/FeePolicy.java | 6 +++++- .../main/java/io/bitsquare/btc/Restrictions.java | 16 ++++++++++++++-- .../java/io/bitsquare/btc/WalletService.java | 5 +++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/io/bitsquare/btc/FeePolicy.java b/core/src/main/java/io/bitsquare/btc/FeePolicy.java index c9fbe38797..752bead4f9 100644 --- a/core/src/main/java/io/bitsquare/btc/FeePolicy.java +++ b/core/src/main/java/io/bitsquare/btc/FeePolicy.java @@ -50,5 +50,9 @@ public class FeePolicy { public static final Coin CREATE_OFFER_FEE = Coin.valueOf(100000); // 0.001 BTC 0.1% of 1 BTC about 0.4 EUR @ 400 EUR/BTC public static final Coin TAKE_OFFER_FEE = CREATE_OFFER_FEE; - public static final Coin SECURITY_DEPOSIT = Coin.valueOf(10000000); // 0.1 BTC; about 40 EUR @ 400 EUR/BTC + + // reduce for mainnet testing + // TODO revert later when tested enough + public static final Coin SECURITY_DEPOSIT = Coin.valueOf(1000000); // 0.01 BTC; about 4 EUR @ 400 EUR/BTC + //public static final Coin SECURITY_DEPOSIT = Coin.valueOf(10000000); // 0.1 BTC; about 40 EUR @ 400 EUR/BTC } diff --git a/core/src/main/java/io/bitsquare/btc/Restrictions.java b/core/src/main/java/io/bitsquare/btc/Restrictions.java index f1dba04aba..23f4940e31 100644 --- a/core/src/main/java/io/bitsquare/btc/Restrictions.java +++ b/core/src/main/java/io/bitsquare/btc/Restrictions.java @@ -21,8 +21,20 @@ import org.bitcoinj.core.Coin; import org.bitcoinj.core.Transaction; public class Restrictions { - public static final Coin MIN_TRADE_AMOUNT = Coin.parseCoin("0.001"); // 40 cent @ 400 EUR/BTC - public static final Coin MAX_TRADE_AMOUNT = Coin.parseCoin("1"); + + // TODO revert later + public static final Coin MIN_TRADE_AMOUNT = Coin.parseCoin("0.0001"); // 4 cent @ 400 EUR/BTC + //public static final Coin MIN_TRADE_AMOUNT = Coin.parseCoin("0.001"); // 40 cent @ 400 EUR/BTC + + public static Coin MAX_TRADE_AMOUNT = Coin.parseCoin("1"); + + // WalletService reduce MAX_TRADE_AMOUNT for mainnet to 0.01 btc + // TODO revert later when tested enough + public static void setMaxTradeAmount(Coin maxTradeAmount) { + MAX_TRADE_AMOUNT = maxTradeAmount; + } + + //public static final Coin MAX_TRADE_AMOUNT = Coin.parseCoin("1"); public static boolean isMinSpendableAmount(Coin amount) { return amount != null && amount.compareTo(FeePolicy.TX_FEE.add(Transaction.MIN_NONDUST_OUTPUT)) > 0; diff --git a/core/src/main/java/io/bitsquare/btc/WalletService.java b/core/src/main/java/io/bitsquare/btc/WalletService.java index e542347b5b..d3850664ff 100644 --- a/core/src/main/java/io/bitsquare/btc/WalletService.java +++ b/core/src/main/java/io/bitsquare/btc/WalletService.java @@ -205,6 +205,11 @@ public class WalletService { walletAppKit.connectToLocalHost(); // You should run a regtest mode bitcoind locally.} } } else if (params == MainNetParams.get()) { + + // reduce for mainnet testing + // TODO revert later when tested enough + Restrictions.setMaxTradeAmount(Coin.parseCoin("0.01")); // 4 EUR @ 400 EUR/BTC + // Checkpoints are block headers that ship inside our app: for a new user, we pick the last header // in the checkpoints file and then download the rest from the network. It makes things much faster. // Checkpoint files are made using the BuildCheckpoints tool and usually we have to download the