mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 10:22:18 +01:00
Add dev flags (STRESS_TEST_MODE)
This commit is contained in:
parent
0488ef4668
commit
be3fc1998f
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
package io.bitsquare.gui.main.offer.createoffer;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import io.bitsquare.app.DevFlags;
|
||||
import io.bitsquare.arbitration.Arbitrator;
|
||||
import io.bitsquare.btc.AddressEntry;
|
||||
import io.bitsquare.btc.FeePolicy;
|
||||
@ -460,7 +461,7 @@ class CreateOfferDataModel extends ActivatableDataModel {
|
||||
log.debug("missingCoin " + missingCoin.get().toFriendlyString());
|
||||
|
||||
isWalletFunded.set(isBalanceSufficient(balance.get()));
|
||||
if (totalToPayAsCoin.get() != null && isWalletFunded.get() && walletFundedNotification == null) {
|
||||
if (totalToPayAsCoin.get() != null && isWalletFunded.get() && walletFundedNotification == null && !DevFlags.DEV_MODE) {
|
||||
walletFundedNotification = new Notification()
|
||||
.headLine("Trading wallet update")
|
||||
.notification("Your trading wallet is sufficiently funded.\n" +
|
||||
|
@ -195,6 +195,9 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
|
||||
onPaymentAccountsComboBoxSelected();
|
||||
|
||||
balanceTextField.setTargetAmount(model.dataModel.totalToPayAsCoin.get());
|
||||
|
||||
if (DevFlags.DEV_MODE)
|
||||
UserThread.runAfter(() -> onShowPayFundsScreen(), 200, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -266,10 +269,14 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
|
||||
if (model.isBootstrapped()) {
|
||||
if (model.hasAcceptedArbitrators()) {
|
||||
Offer offer = model.createAndGetOffer();
|
||||
offerDetailsWindow.onPlaceOffer(() ->
|
||||
model.onPlaceOffer(offer, () ->
|
||||
offerDetailsWindow.hide()))
|
||||
.show(offer);
|
||||
if (!DevFlags.DEV_MODE)
|
||||
offerDetailsWindow.onPlaceOffer(() ->
|
||||
model.onPlaceOffer(offer, () ->
|
||||
offerDetailsWindow.hide()))
|
||||
.show(offer);
|
||||
else
|
||||
model.onPlaceOffer(offer, () -> {
|
||||
});
|
||||
} else {
|
||||
new Popup().warning("You have no arbitrator selected.\n" +
|
||||
"You need to select at least one arbitrator.")
|
||||
@ -613,7 +620,6 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
|
||||
placeOfferCompletedListener = (o, oldValue, newValue) -> {
|
||||
if (DevFlags.DEV_MODE) {
|
||||
close();
|
||||
navigation.navigateTo(MainView.class, PortfolioView.class, OpenOffersView.class);
|
||||
} else if (newValue) {
|
||||
// We need a bit of delay to avoid issues with fade out/fade in of 2 popups
|
||||
String key = "createOfferSuccessInfo";
|
||||
|
@ -275,12 +275,16 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
||||
|
||||
private void onTakeOffer() {
|
||||
if (model.hasAcceptedArbitrators()) {
|
||||
offerDetailsWindow.onTakeOffer(() ->
|
||||
model.onTakeOffer(() -> {
|
||||
offerDetailsWindow.hide();
|
||||
offerDetailsWindowDisplayed = false;
|
||||
})
|
||||
).show(model.getOffer(), model.dataModel.amountAsCoin.get(), model.dataModel.tradePrice);
|
||||
if (!DevFlags.DEV_MODE)
|
||||
offerDetailsWindow.onTakeOffer(() ->
|
||||
model.onTakeOffer(() -> {
|
||||
offerDetailsWindow.hide();
|
||||
offerDetailsWindowDisplayed = false;
|
||||
})
|
||||
).show(model.getOffer(), model.dataModel.amountAsCoin.get(), model.dataModel.tradePrice);
|
||||
else
|
||||
model.onTakeOffer(() -> {
|
||||
});
|
||||
offerDetailsWindowDisplayed = true;
|
||||
} else {
|
||||
new Popup().warning("You have no arbitrator selected.\n" +
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
package io.bitsquare.gui.util;
|
||||
|
||||
import io.bitsquare.app.DevFlags;
|
||||
import io.bitsquare.gui.main.overlays.popups.Popup;
|
||||
import io.bitsquare.user.Preferences;
|
||||
import javafx.geometry.Orientation;
|
||||
@ -40,7 +41,7 @@ public class GUIUtil {
|
||||
|
||||
public static void showFeeInfoBeforeExecute(Runnable runnable) {
|
||||
String key = "miningFeeInfo";
|
||||
if (Preferences.INSTANCE.showAgain(key)) {
|
||||
if (!DevFlags.DEV_MODE && Preferences.INSTANCE.showAgain(key)) {
|
||||
new Popup<>().information("Please be sure that the mining fee used at your external wallet is " +
|
||||
"sufficiently high so that the funding transaction will be added to the blockchain.\n" +
|
||||
"Otherwise the trade transactions cannot be confirmed and a trade would end up in a dispute.\n\n" +
|
||||
|
Loading…
Reference in New Issue
Block a user