mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-31 10:49:19 -04:00
Add dev flags (STRESS_TEST_MODE)
This commit is contained in:
parent
0488ef4668
commit
be3fc1998f
5 changed files with 31 additions and 18 deletions
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package io.bitsquare.btc;
|
package io.bitsquare.btc;
|
||||||
|
|
||||||
|
import io.bitsquare.app.DevFlags;
|
||||||
import org.bitcoinj.core.Coin;
|
import org.bitcoinj.core.Coin;
|
||||||
|
|
||||||
public class FeePolicy {
|
public class FeePolicy {
|
||||||
|
@ -41,7 +42,7 @@ public class FeePolicy {
|
||||||
// software updates
|
// software updates
|
||||||
// TODO before Beta we should get a good future proof guess as a change causes incompatible versions
|
// TODO before Beta we should get a good future proof guess as a change causes incompatible versions
|
||||||
public static Coin getFixedTxFeeForTrades() {
|
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
|
// 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.
|
// 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
|
// 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
|
// 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) {
|
public static void setNonTradeFeePerKb(Coin nonTradeFeePerKb) {
|
||||||
NON_TRADE_FEE_PER_KB = nonTradeFeePerKb;
|
NON_TRADE_FEE_PER_KB = nonTradeFeePerKb;
|
||||||
|
@ -64,18 +65,18 @@ public class FeePolicy {
|
||||||
public static Coin getCreateOfferFee() {
|
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
|
// 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
|
// 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
|
// 0.001 BTC 0.1% of 1 BTC about 0.4 EUR @ 400 EUR/BTC
|
||||||
public static Coin getTakeOfferFee() {
|
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
|
// TODO will be increased once we get higher limits
|
||||||
// 0.01 BTC; about 4 EUR @ 400 EUR/BTC
|
// 0.01 BTC; about 4 EUR @ 400 EUR/BTC
|
||||||
public static Coin getSecurityDeposit() {
|
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;
|
package io.bitsquare.gui.main.offer.createoffer;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
import io.bitsquare.app.DevFlags;
|
||||||
import io.bitsquare.arbitration.Arbitrator;
|
import io.bitsquare.arbitration.Arbitrator;
|
||||||
import io.bitsquare.btc.AddressEntry;
|
import io.bitsquare.btc.AddressEntry;
|
||||||
import io.bitsquare.btc.FeePolicy;
|
import io.bitsquare.btc.FeePolicy;
|
||||||
|
@ -460,7 +461,7 @@ class CreateOfferDataModel extends ActivatableDataModel {
|
||||||
log.debug("missingCoin " + missingCoin.get().toFriendlyString());
|
log.debug("missingCoin " + missingCoin.get().toFriendlyString());
|
||||||
|
|
||||||
isWalletFunded.set(isBalanceSufficient(balance.get()));
|
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()
|
walletFundedNotification = new Notification()
|
||||||
.headLine("Trading wallet update")
|
.headLine("Trading wallet update")
|
||||||
.notification("Your trading wallet is sufficiently funded.\n" +
|
.notification("Your trading wallet is sufficiently funded.\n" +
|
||||||
|
|
|
@ -195,6 +195,9 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
|
||||||
onPaymentAccountsComboBoxSelected();
|
onPaymentAccountsComboBoxSelected();
|
||||||
|
|
||||||
balanceTextField.setTargetAmount(model.dataModel.totalToPayAsCoin.get());
|
balanceTextField.setTargetAmount(model.dataModel.totalToPayAsCoin.get());
|
||||||
|
|
||||||
|
if (DevFlags.DEV_MODE)
|
||||||
|
UserThread.runAfter(() -> onShowPayFundsScreen(), 200, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -266,10 +269,14 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
|
||||||
if (model.isBootstrapped()) {
|
if (model.isBootstrapped()) {
|
||||||
if (model.hasAcceptedArbitrators()) {
|
if (model.hasAcceptedArbitrators()) {
|
||||||
Offer offer = model.createAndGetOffer();
|
Offer offer = model.createAndGetOffer();
|
||||||
|
if (!DevFlags.DEV_MODE)
|
||||||
offerDetailsWindow.onPlaceOffer(() ->
|
offerDetailsWindow.onPlaceOffer(() ->
|
||||||
model.onPlaceOffer(offer, () ->
|
model.onPlaceOffer(offer, () ->
|
||||||
offerDetailsWindow.hide()))
|
offerDetailsWindow.hide()))
|
||||||
.show(offer);
|
.show(offer);
|
||||||
|
else
|
||||||
|
model.onPlaceOffer(offer, () -> {
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
new Popup().warning("You have no arbitrator selected.\n" +
|
new Popup().warning("You have no arbitrator selected.\n" +
|
||||||
"You need to select at least one arbitrator.")
|
"You need to select at least one arbitrator.")
|
||||||
|
@ -613,7 +620,6 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
|
||||||
placeOfferCompletedListener = (o, oldValue, newValue) -> {
|
placeOfferCompletedListener = (o, oldValue, newValue) -> {
|
||||||
if (DevFlags.DEV_MODE) {
|
if (DevFlags.DEV_MODE) {
|
||||||
close();
|
close();
|
||||||
navigation.navigateTo(MainView.class, PortfolioView.class, OpenOffersView.class);
|
|
||||||
} else if (newValue) {
|
} else if (newValue) {
|
||||||
// We need a bit of delay to avoid issues with fade out/fade in of 2 popups
|
// We need a bit of delay to avoid issues with fade out/fade in of 2 popups
|
||||||
String key = "createOfferSuccessInfo";
|
String key = "createOfferSuccessInfo";
|
||||||
|
|
|
@ -275,12 +275,16 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
||||||
|
|
||||||
private void onTakeOffer() {
|
private void onTakeOffer() {
|
||||||
if (model.hasAcceptedArbitrators()) {
|
if (model.hasAcceptedArbitrators()) {
|
||||||
|
if (!DevFlags.DEV_MODE)
|
||||||
offerDetailsWindow.onTakeOffer(() ->
|
offerDetailsWindow.onTakeOffer(() ->
|
||||||
model.onTakeOffer(() -> {
|
model.onTakeOffer(() -> {
|
||||||
offerDetailsWindow.hide();
|
offerDetailsWindow.hide();
|
||||||
offerDetailsWindowDisplayed = false;
|
offerDetailsWindowDisplayed = false;
|
||||||
})
|
})
|
||||||
).show(model.getOffer(), model.dataModel.amountAsCoin.get(), model.dataModel.tradePrice);
|
).show(model.getOffer(), model.dataModel.amountAsCoin.get(), model.dataModel.tradePrice);
|
||||||
|
else
|
||||||
|
model.onTakeOffer(() -> {
|
||||||
|
});
|
||||||
offerDetailsWindowDisplayed = true;
|
offerDetailsWindowDisplayed = true;
|
||||||
} else {
|
} else {
|
||||||
new Popup().warning("You have no arbitrator selected.\n" +
|
new Popup().warning("You have no arbitrator selected.\n" +
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package io.bitsquare.gui.util;
|
package io.bitsquare.gui.util;
|
||||||
|
|
||||||
|
import io.bitsquare.app.DevFlags;
|
||||||
import io.bitsquare.gui.main.overlays.popups.Popup;
|
import io.bitsquare.gui.main.overlays.popups.Popup;
|
||||||
import io.bitsquare.user.Preferences;
|
import io.bitsquare.user.Preferences;
|
||||||
import javafx.geometry.Orientation;
|
import javafx.geometry.Orientation;
|
||||||
|
@ -40,7 +41,7 @@ public class GUIUtil {
|
||||||
|
|
||||||
public static void showFeeInfoBeforeExecute(Runnable runnable) {
|
public static void showFeeInfoBeforeExecute(Runnable runnable) {
|
||||||
String key = "miningFeeInfo";
|
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 " +
|
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" +
|
"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" +
|
"Otherwise the trade transactions cannot be confirmed and a trade would end up in a dispute.\n\n" +
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue