Add dev flags (STRESS_TEST_MODE)

This commit is contained in:
Manfred Karrer 2016-05-25 13:30:00 +02:00
parent 0488ef4668
commit be3fc1998f
5 changed files with 31 additions and 18 deletions

View file

@ -17,6 +17,7 @@
package io.bitsquare.btc;
import io.bitsquare.app.DevFlags;
import org.bitcoinj.core.Coin;
public class FeePolicy {
@ -41,7 +42,7 @@ public class FeePolicy {
// software updates
// TODO before Beta we should get a good future proof guess as a change causes incompatible versions
public static Coin getFixedTxFeeForTrades() {
return Coin.valueOf(20_000);
return DevFlags.STRESS_TEST_MODE ? Coin.valueOf(5_000) : Coin.valueOf(20_000);
}
// For non trade transactions (withdrawal) we use the default fee calculation
@ -50,7 +51,7 @@ public class FeePolicy {
// The BitcoinJ fee calculation use kb so a tx size < 1kb will still pay the fee for a kb tx.
// Our payout tx has about 370 bytes so we get a fee/kb value of about 90 satoshi/byte making it high priority
// Other payout transactions (E.g. arbitrators many collected transactions) will go with 30 satoshi/byte if > 1kb
private static Coin NON_TRADE_FEE_PER_KB = Coin.valueOf(10_000); // 0.0001 BTC about 0.04 EUR @ 400 EUR/BTC
private static Coin NON_TRADE_FEE_PER_KB = DevFlags.STRESS_TEST_MODE ? Coin.valueOf(5_000) : Coin.valueOf(10_000); // 0.0001 BTC about 0.04 EUR @ 400 EUR/BTC
public static void setNonTradeFeePerKb(Coin nonTradeFeePerKb) {
NON_TRADE_FEE_PER_KB = nonTradeFeePerKb;
@ -64,18 +65,18 @@ public class FeePolicy {
public static Coin getCreateOfferFee() {
// We need to pay the quite high miner fee of 30_000 from the trading fee tx so 30_000 us our lower limit
// The arbitrator receive only 0.0002 BTC - less than the miners
return Coin.valueOf(50_000);
return DevFlags.STRESS_TEST_MODE ? Coin.valueOf(10_000) : Coin.valueOf(50_000);
}
// 0.001 BTC 0.1% of 1 BTC about 0.4 EUR @ 400 EUR/BTC
public static Coin getTakeOfferFee() {
return Coin.valueOf(100_000);
return DevFlags.STRESS_TEST_MODE ? Coin.valueOf(10_000) : Coin.valueOf(100_000);
}
// TODO will be increased once we get higher limits
// 0.01 BTC; about 4 EUR @ 400 EUR/BTC
public static Coin getSecurityDeposit() {
return Coin.valueOf(1_000_000);
return DevFlags.STRESS_TEST_MODE ? Coin.valueOf(5_000) : Coin.valueOf(1_000_000);
}
}