Merge pull request #2447 from ManfredKarrer/dao-serverside-regtest

Dao serverside regtest
This commit is contained in:
Manfred Karrer 2019-02-21 07:32:40 -05:00 committed by GitHub
commit d47fec2620
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 96 additions and 181 deletions

View file

@ -166,8 +166,7 @@ public class BisqEnvironment extends StandardEnvironment {
public static boolean isDaoActivated(Environment environment) {
Boolean daoActivatedFromOptions = environment.getProperty(DaoOptionKeys.DAO_ACTIVATED, Boolean.class, false);
BaseCurrencyNetwork baseCurrencyNetwork = BisqEnvironment.getBaseCurrencyNetwork();
boolean isRegTestOrTestNet = (baseCurrencyNetwork.isTestnet() || baseCurrencyNetwork.isRegtest());
return daoActivatedFromOptions || isRegTestOrTestNet;
return daoActivatedFromOptions || !baseCurrencyNetwork.isMainnet();
}

View file

@ -68,6 +68,7 @@ import lombok.extern.slf4j.Slf4j;
import static bisq.core.app.BisqEnvironment.DEFAULT_APP_NAME;
import static bisq.core.app.BisqEnvironment.DEFAULT_USER_DATA_DIR;
import static bisq.core.btc.BaseCurrencyNetwork.BTC_DAO_TESTNET;
import static bisq.core.btc.BaseCurrencyNetwork.BTC_MAINNET;
import static bisq.core.btc.BaseCurrencyNetwork.BTC_REGTEST;
import static bisq.core.btc.BaseCurrencyNetwork.BTC_TESTNET;
@ -479,7 +480,7 @@ public abstract class BisqExecutable implements GracefulShutDownHandler, BisqSet
format("Base currency network (default: %s)", BisqEnvironment.getDefaultBaseCurrencyNetwork().name()))
.withRequiredArg()
.ofType(String.class)
.describedAs(format("%s|%s|%s", BTC_MAINNET, BTC_TESTNET, BTC_REGTEST));
.describedAs(format("%s|%s|%s|%s", BTC_MAINNET, BTC_TESTNET, BTC_REGTEST, BTC_DAO_TESTNET));
parser.accepts(BtcOptionKeys.REG_TEST_HOST,
format("Bitcoin regtest host when using BTC_REGTEST network (default: %s)", RegTestHost.DEFAULT_HOST))

View file

@ -47,7 +47,7 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public abstract class ExecutableForAppWithP2p extends BisqExecutable implements UncaughtExceptionHandler {
private static final long MAX_MEMORY_MB_DEFAULT = 500;
private static final long CHECK_MEMORY_PERIOD_SEC = 10;
private static final long CHECK_MEMORY_PERIOD_SEC = 300;
private volatile boolean stopped;
private static long maxMemory = MAX_MEMORY_MB_DEFAULT;

View file

@ -27,7 +27,8 @@ import lombok.Getter;
public enum BaseCurrencyNetwork {
BTC_MAINNET(MainNetParams.get(), "BTC", "MAINNET", "Bitcoin"),
BTC_TESTNET(TestNet3Params.get(), "BTC", "TESTNET", "Bitcoin"),
BTC_REGTEST(RegTestParams.get(), "BTC", "REGTEST", "Bitcoin");
BTC_REGTEST(RegTestParams.get(), "BTC", "REGTEST", "Bitcoin"),
BTC_DAO_TESTNET(RegTestParams.get(), "BTC", "REGTEST", "Bitcoin"); // server side regtest
@Getter
private final NetworkParameters parameters;
@ -46,19 +47,19 @@ public enum BaseCurrencyNetwork {
}
public boolean isMainnet() {
return "MAINNET".equals(network);
return "BTC_MAINNET".equals(name());
}
public boolean isTestnet() {
return "TESTNET".equals(network);
return "BTC_TESTNET".equals(name());
}
public boolean isDaoTestNet() {
return "BTC_DAO_TESTNET".equals(name());
}
public boolean isRegtest() {
return "REGTEST".equals(network);
}
public boolean isBitcoin() {
return "BTC".equals(currencyCode);
return "BTC_REGTEST".equals(name());
}
public long getDefaultMinFeePerByte() {

View file

@ -18,6 +18,7 @@
package bisq.core.btc;
import bisq.core.app.AppOptionKeys;
import bisq.core.app.BisqEnvironment;
import bisq.core.btc.model.AddressEntryList;
import bisq.core.btc.nodes.BtcNodes;
import bisq.core.btc.setup.RegTestHost;
@ -53,13 +54,18 @@ public class BitcoinModule extends AppModule {
@Override
protected void configure() {
String regTestHost = environment.getProperty(BtcOptionKeys.REG_TEST_HOST, String.class, RegTestHost.DEFAULT_HOST);
// We we have selected BTC_DAO_TESTNET we use our master regtest node, otherwise the specified host or default
// (localhost)
String regTestHost = BisqEnvironment.getBaseCurrencyNetwork().isDaoTestNet() ?
"104.248.31.39" :
environment.getProperty(BtcOptionKeys.REG_TEST_HOST, String.class, RegTestHost.DEFAULT_HOST);
RegTestHost.HOST = regTestHost;
if (Arrays.asList("localhost", "127.0.0.1").contains(regTestHost)) {
bind(RegTestHost.class).toInstance(RegTestHost.LOCALHOST);
} else {
bind(RegTestHost.class).toInstance(RegTestHost.REMOTE_HOST);
}
RegTestHost.HOST = regTestHost;
bindConstant().annotatedWith(named(UserAgent.NAME_KEY)).to(environment.getRequiredProperty(UserAgent.NAME_KEY));
bindConstant().annotatedWith(named(UserAgent.VERSION_KEY)).to(environment.getRequiredProperty(UserAgent.VERSION_KEY));

View file

@ -85,7 +85,7 @@ public class BtcNodes {
}
public boolean useProvidedBtcNodes() {
return BisqEnvironment.getBaseCurrencyNetwork().isBitcoin() && BisqEnvironment.getBaseCurrencyNetwork().isMainnet();
return BisqEnvironment.getBaseCurrencyNetwork().isMainnet();
}
public static List<BtcNodes.BtcNode> toBtcNodesList(Collection<String> nodes) {

View file

@ -100,9 +100,9 @@ public enum Param {
// but can be also a burner address if we prefer to burn the BTC
RECIPIENT_BTC_ADDRESS(BisqEnvironment.getBaseCurrencyNetwork().isMainnet() ?
"1BVxNn3T12veSK6DgqwU4Hdn7QHcDDRag7" : // mainnet
BisqEnvironment.getBaseCurrencyNetwork().isRegtest() ?
"2N5J6MyjAsWnashimGiNwoRzUXThsQzRmbv" : // regtest
"2N4mVTpUZAnhm9phnxB7VrHB4aBhnWrcUrV", // testnet
BisqEnvironment.getBaseCurrencyNetwork().isTestnet() ?
"2N4mVTpUZAnhm9phnxB7VrHB4aBhnWrcUrV" : // testnet
"mquz1zFmhs7iy8qJTkhY7C9bhJ5S3g8Xim", // regtest or DAO testnet (regtest)
ParamType.ADDRESS),
// Fee for activating an asset or re-listing after deactivation due lack of trade activity. Fee per day of trial period without activity checks.
@ -128,43 +128,43 @@ public enum Param {
"3601" : // mainnet; 24 days
BisqEnvironment.getBaseCurrencyNetwork().isRegtest() ?
"4" : // regtest
"380", // testnet; 2.6 days
"380", // testnet or dao testnet (server side regtest); 2.6 days
ParamType.BLOCK, 3, 3),
PHASE_BREAK1(BisqEnvironment.getBaseCurrencyNetwork().isMainnet() ?
"149" : // mainnet; 1 day
BisqEnvironment.getBaseCurrencyNetwork().isRegtest() ?
"1" : // regtest
"10", // testnet
"10", // testnet or dao testnet (server side regtest)
ParamType.BLOCK, 3, 3),
PHASE_BLIND_VOTE(BisqEnvironment.getBaseCurrencyNetwork().isMainnet() ?
"601" : // mainnet; 4 days
BisqEnvironment.getBaseCurrencyNetwork().isRegtest() ?
"2" : // regtest
"300", // testnet; 2 days
"300", // testnet or dao testnet (server side regtest); 2 days
ParamType.BLOCK, 3, 3),
PHASE_BREAK2(BisqEnvironment.getBaseCurrencyNetwork().isMainnet() ?
"9" : // mainnet
BisqEnvironment.getBaseCurrencyNetwork().isRegtest() ?
"1" : // regtest
"10", // testnet
"10", // testnet or dao testnet (server side regtest)
ParamType.BLOCK, 3, 23),
PHASE_VOTE_REVEAL(BisqEnvironment.getBaseCurrencyNetwork().isMainnet() ?
"301" : // mainnet; 2 days
BisqEnvironment.getBaseCurrencyNetwork().isRegtest() ?
"2" : // regtest
"300", // testnet; 2 days
"300", // testnet or dao testnet (server side regtest); 2 days
ParamType.BLOCK, 3, 3),
PHASE_BREAK3(BisqEnvironment.getBaseCurrencyNetwork().isMainnet() ?
"9" : // mainnet
BisqEnvironment.getBaseCurrencyNetwork().isRegtest() ?
"1" : // regtest
"10", // testnet
"10", // testnet or dao testnet (server side regtest)
ParamType.BLOCK, 3, 3),
PHASE_RESULT(BisqEnvironment.getBaseCurrencyNetwork().isMainnet() ?
"10" : // mainnet
BisqEnvironment.getBaseCurrencyNetwork().isRegtest() ?
"2" : // regtest
"2", // testnet
"2", // testnet or dao testnet (server side regtest)
ParamType.BLOCK, 3, 3);
@Getter

View file

@ -101,10 +101,12 @@ public class RpcService {
boolean isPortSet = rpcPort != null && !rpcPort.isEmpty();
boolean isMainnet = BisqEnvironment.getBaseCurrencyNetwork().isMainnet();
boolean isTestnet = BisqEnvironment.getBaseCurrencyNetwork().isTestnet();
boolean isDaoTestNet = BisqEnvironment.getBaseCurrencyNetwork().isDaoTestNet();
this.rpcPort = isPortSet ? rpcPort :
isMainnet ? "8332" :
isTestnet ? "18332" :
"18443"; // regtest
isDaoTestNet ? "18443" :
"18443"; // regtest
this.rpcBlockPort = rpcBlockPort != null && !rpcBlockPort.isEmpty() ? rpcBlockPort : "5125";
this.dumpBlockchainData = dumpBlockchainData;

View file

@ -197,16 +197,17 @@ public class DaoStateService implements DaoSetupService {
if (daoState.getBlocks().isEmpty() && block.getHeight() != getGenesisBlockHeight()) {
log.warn("We don't have any blocks yet and we received a block which is not the genesis block. " +
"We ignore that block as the first block need to be the genesis block. " +
"That might happen in edge cases at reorgs.");
"That might happen in edge cases at reorgs. Received block={}", block);
} else {
daoState.getBlocks().add(block);
log.info("New Block added at blockHeight " + block.getHeight());
log.info("New Block added at blockHeight {}", block.getHeight());
}
}
// Third we get the onParseBlockComplete called after all rawTxs of blocks have been parsed
public void onParseBlockComplete(Block block) {
log.info("Parse block completed: Block height {}, {} BSQ transactions.", block.getHeight(), block.getTxs().size());
// We use 2 different handlers as we don't want to update domain listeners during batch processing of all
// blocks as that cause performance issues. In earlier versions when we updated at each block it took
// 50 sec. for 4000 blocks, after that change it was about 4 sec.
@ -218,6 +219,7 @@ public class DaoStateService implements DaoSetupService {
// Called after parsing of all pending blocks is completed
public void onParseBlockChainComplete() {
log.info("Parse blockchain completed");
parseBlockChainComplete = true;
getLastBlock().ifPresent(block -> {

View file

@ -51,6 +51,9 @@ public class GenesisTxInfo {
private static final String TESTNET_GENESIS_TX_ID = "09e70ce0ab7a962a82a2ca84c9ae8a89140bf1c3fb6f7efad6162e39e4b362ae";
private static final int TESTNET_GENESIS_BLOCK_HEIGHT = 1446300; // 2018-12-02
private static final String DAO_TESTNET_GENESIS_TX_ID = "cb316a186b9e88d1b8e1ce8dc79cc6a2080cc7bbc6df94f2be325d8253417af1";
private static final int DAO_TESTNET_GENESIS_BLOCK_HEIGHT = 104; // 2019-02-19
private static final String REGTEST_GENESIS_TX_ID = "30af0050040befd8af25068cc697e418e09c2d8ebd8d411d2240591b9ec203cf";
private static final int REGTEST_GENESIS_BLOCK_HEIGHT = 111;
@ -93,6 +96,7 @@ public class GenesisTxInfo {
BaseCurrencyNetwork baseCurrencyNetwork = BisqEnvironment.getBaseCurrencyNetwork();
boolean isMainnet = baseCurrencyNetwork.isMainnet();
boolean isTestnet = baseCurrencyNetwork.isTestnet();
boolean isDaoTestNet = baseCurrencyNetwork.isDaoTestNet();
boolean isRegtest = baseCurrencyNetwork.isRegtest();
if (!genesisTxId.isEmpty()) {
this.genesisTxId = genesisTxId;
@ -100,6 +104,8 @@ public class GenesisTxInfo {
this.genesisTxId = MAINNET_GENESIS_TX_ID;
} else if (isTestnet) {
this.genesisTxId = TESTNET_GENESIS_TX_ID;
} else if (isDaoTestNet) {
this.genesisTxId = DAO_TESTNET_GENESIS_TX_ID;
} else if (isRegtest) {
this.genesisTxId = REGTEST_GENESIS_TX_ID;
} else {
@ -112,6 +118,8 @@ public class GenesisTxInfo {
this.genesisBlockHeight = MAINNET_GENESIS_BLOCK_HEIGHT;
} else if (isTestnet) {
this.genesisBlockHeight = TESTNET_GENESIS_BLOCK_HEIGHT;
} else if (isDaoTestNet) {
this.genesisBlockHeight = DAO_TESTNET_GENESIS_BLOCK_HEIGHT;
} else if (isRegtest) {
this.genesisBlockHeight = REGTEST_GENESIS_BLOCK_HEIGHT;
} else {

View file

@ -422,8 +422,7 @@ public class CurrencyUtil {
// We want all coins available also in testnet or regtest for testing purpose
public static boolean coinMatchesNetworkIfMainnet(Coin coin, BaseCurrencyNetwork baseCurrencyNetwork) {
boolean matchesNetwork = assetMatchesNetwork(coin, baseCurrencyNetwork);
return !baseCurrencyNetwork.isMainnet() ||
matchesNetwork;
return !baseCurrencyNetwork.isMainnet() || matchesNetwork;
}
private static CryptoCurrency assetToCryptoCurrency(Asset asset) {

View file

@ -67,10 +67,10 @@ class DefaultSeedNodeAddresses {
// BTC testnet
// new NodeAddress("vjkh4ykq7x5skdlt.onion:8001"), // local dev test
new NodeAddress("fjr5w4eckjghqtnu.onion:8001"), // testnet seed 1
new NodeAddress("74w2sttlo4qk6go3.onion:8001"), // testnet seed 2
//new NodeAddress("fjr5w4eckjghqtnu.onion:8001"), // testnet seed 1
/* new NodeAddress("74w2sttlo4qk6go3.onion:8001"), // testnet seed 2
new NodeAddress("jmc5ajqvtnzqaggm.onion:8001"), // testnet seed 3
new NodeAddress("3d56s6acbi3vk52v.onion:8001"), // testnet seed 4
new NodeAddress("3d56s6acbi3vk52v.onion:8001"), // testnet seed 4*/
// BTC regtest
// For development you need to change that to your local onion addresses
@ -80,8 +80,16 @@ class DefaultSeedNodeAddresses {
// 4. Rename the directory with your local onion address
// 5. Edit here your found onion address (new NodeAddress("YOUR_ONION.onion:8002")
new NodeAddress("rxdkppp3vicnbgqt.onion:8002"),
new NodeAddress("4ie52dse64kaarxw.onion:8002")
new NodeAddress("4ie52dse64kaarxw.onion:8002"),
// DAO TESTNET (server side regtest dedicated for DAO testing)
new NodeAddress("fjr5w4eckjghqtnu.onion:8003"), // testnet seed 1
new NodeAddress("74w2sttlo4qk6go3.onion:8003"), // testnet seed 2
new NodeAddress("jmc5ajqvtnzqaggm.onion:8003"), // testnet seed 3
new NodeAddress("3d56s6acbi3vk52v.onion:8003") // testnet seed 4
// explorer
// new NodeAddress("gtif46mfxirv533z.onion:8003")
);
private DefaultSeedNodeAddresses() {

View file

@ -141,7 +141,7 @@ public class AssetTradeActivityCheck {
"\n\n" + newAssets.toString() +
"\n\n" + sufficientlyTraded.toString();
// Utilities.copyToClipboard(result);
log.info(result);
log.debug(result);
}
private boolean isWarmingUp(String code) {

View file

@ -56,6 +56,7 @@ import javafx.collections.ObservableMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@ -89,8 +90,7 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
new BlockChainExplorer("SoChain. Wow.", "https://chain.so/tx/BTC/", "https://chain.so/address/BTC/"),
new BlockChainExplorer("Blockchain.info", "https://blockchain.info/tx/", "https://blockchain.info/address/"),
new BlockChainExplorer("Insight", "https://insight.bitpay.com/tx/", "https://insight.bitpay.com/address/")
)
);
));
private static final ArrayList<BlockChainExplorer> BTC_TEST_NET_EXPLORERS = new ArrayList<>(Arrays.asList(
new BlockChainExplorer("Blockstream.info", "https://blockstream.info/testnet/tx/", "https://blockstream.info/testnet/address/"),
new BlockChainExplorer("Blockstream.info Tor V3", "http://explorerzydxu5ecjrkwceayqybizmpjjznk5izmitf2modhcusuqlid.onion/testnet/tx/", "http://explorerzydxu5ecjrkwceayqybizmpjjznk5izmitf2modhcusuqlid.onion/testnet/address/"),
@ -100,6 +100,9 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
new BlockChainExplorer("Smartbit", "https://testnet.smartbit.com.au/tx/", "https://testnet.smartbit.com.au/address/"),
new BlockChainExplorer("SoChain. Wow.", "https://chain.so/tx/BTCTEST/", "https://chain.so/address/BTCTEST/")
));
private static final ArrayList<BlockChainExplorer> BTC_DAO_TEST_NET_EXPLORERS = new ArrayList<>(Collections.singletonList(
new BlockChainExplorer("Bisq.info", "https://bisq.info/dao_testnet/tx/", "https://bisq.info/dao_testnet/address/")
));
public static final BlockChainExplorer BSQ_MAIN_NET_EXPLORER = new BlockChainExplorer("BSQ", "https://explorer.bisq.network/tx.html?tx=",
"https://explorer.bisq.network/Address.html?addr=");
@ -639,20 +642,30 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
}
public BlockChainExplorer getBlockChainExplorer() {
if (BisqEnvironment.getBaseCurrencyNetwork().isMainnet())
return prefPayload.getBlockChainExplorerMainNet();
else
return prefPayload.getBlockChainExplorerTestNet();
BaseCurrencyNetwork baseCurrencyNetwork = BisqEnvironment.getBaseCurrencyNetwork();
switch (baseCurrencyNetwork) {
case BTC_MAINNET:
return prefPayload.getBlockChainExplorerMainNet();
case BTC_TESTNET:
case BTC_REGTEST:
return prefPayload.getBlockChainExplorerTestNet();
case BTC_DAO_TESTNET:
return BTC_DAO_TEST_NET_EXPLORERS.get(0);
default:
throw new RuntimeException("BaseCurrencyNetwork not defined. BaseCurrencyNetwork=" + baseCurrencyNetwork);
}
}
public ArrayList<BlockChainExplorer> getBlockChainExplorers() {
final BaseCurrencyNetwork baseCurrencyNetwork = BisqEnvironment.getBaseCurrencyNetwork();
BaseCurrencyNetwork baseCurrencyNetwork = BisqEnvironment.getBaseCurrencyNetwork();
switch (baseCurrencyNetwork) {
case BTC_MAINNET:
return BTC_MAIN_NET_EXPLORERS;
case BTC_TESTNET:
case BTC_REGTEST:
return BTC_TEST_NET_EXPLORERS;
case BTC_DAO_TESTNET:
return BTC_DAO_TEST_NET_EXPLORERS;
default:
throw new RuntimeException("BaseCurrencyNetwork not defined. BaseCurrencyNetwork=" + baseCurrencyNetwork);
}

View file

@ -2283,6 +2283,8 @@ BTC_MAINNET=Bitcoin Mainnet
BTC_TESTNET=Bitcoin Testnet
# suppress inspection "UnusedProperty"
BTC_REGTEST=Bitcoin Regtest
# suppress inspection "UnusedProperty"
BTC_DAO_TESTNET=Bitcoin DAO Testnet
time.year=Year
time.month=Month

View file

@ -21,14 +21,9 @@ import bisq.core.app.BisqEnvironment;
import bisq.network.p2p.NodeAddress;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import java.security.Security;
import java.util.Collections;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@ -41,7 +36,7 @@ public class SeedNodeAddressLookupTest {
@Test
public void testResolveNodeAddressesWhenLocalAddressSpecified() {
SeedNodeAddressLookup lookup = new SeedNodeAddressLookup(
mock(BisqEnvironment.class), false, 1, "192.168.0.1:1234",
mock(BisqEnvironment.class), false, 0, "192.168.0.1:1234",
"192.168.0.1:1234, 192.168.0.2:9897");
Set<NodeAddress> actual = lookup.resolveNodeAddresses();
@ -52,7 +47,7 @@ public class SeedNodeAddressLookupTest {
@Test
public void testResolveNodeAddressesWhenSeedNodesAreNull() {
SeedNodeAddressLookup lookup = new SeedNodeAddressLookup(
mock(BisqEnvironment.class), false, 1, "192.168.0.1:1234", null);
mock(BisqEnvironment.class), false, 0, "192.168.0.1:1234", null);
Set<NodeAddress> actual = lookup.resolveNodeAddresses();
assertFalse(actual.isEmpty());

View file

@ -238,10 +238,9 @@ public class BisqApp extends Application implements UncaughtExceptionHandler {
// configure the primary stage
String appName = injector.getInstance(Key.get(String.class, Names.named(AppOptionKeys.APP_NAME_KEY)));
if (BisqEnvironment.getBaseCurrencyNetwork().isTestnet())
appName += " [TESTNET]";
else if (BisqEnvironment.getBaseCurrencyNetwork().isRegtest())
appName += " [REGTEST]";
if (!BisqEnvironment.getBaseCurrencyNetwork().isMainnet())
appName += " [" + Res.get(BisqEnvironment.getBaseCurrencyNetwork().name()) + "]";
stage.setTitle(appName);
stage.setScene(scene);
stage.setMinWidth(MIN_WINDOW_WIDTH);

View file

@ -257,7 +257,6 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> implements
}
///////////////////////////////////////////////////////////////////////////////////////////
// Private
///////////////////////////////////////////////////////////////////////////////////////////
@ -279,11 +278,11 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> implements
Coin fee = daoFacade.getProposalFee(daoFacade.getChainHeight());
if (type.equals(ProposalType.BONDED_ROLE)) {
final long requiredBond = proposalDisplay.bondedRoleTypeComboBox.getSelectionModel().getSelectedItem().getRequiredBond();
final long availableBalance = bsqWalletService.getAvailableBalance().value;
long requiredBond = proposalDisplay.bondedRoleTypeComboBox.getSelectionModel().getSelectedItem().getRequiredBond();
long availableBalance = bsqWalletService.getAvailableBalance().value;
if (requiredBond > availableBalance) {
final long missing = requiredBond - availableBalance;
long missing = requiredBond - availableBalance;
new Popup<>().warning(Res.get("dao.proposal.create.missingBsqFundsForBond",
bsqFormatter.formatCoinWithCode(missing)))
.actionButtonText(Res.get("dao.proposal.create.publish"))
@ -291,6 +290,8 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> implements
showFeeInfoAndPublishMyProposal(proposal, transaction, miningFee, txSize, fee);
})
.show();
} else {
showFeeInfoAndPublishMyProposal(proposal, transaction, miningFee, txSize, fee);
}
} else {
showFeeInfoAndPublishMyProposal(proposal, transaction, miningFee, txSize, fee);
@ -330,7 +331,6 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> implements
}
private void doPublishMyProposal(Proposal proposal, Transaction transaction) {
busyLabel.setVisible(true);
busyAnimation.play();
makeProposalButton.setDisable(true);

View file

@ -1,119 +0,0 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.desktop.main.overlays.windows;
import bisq.desktop.main.overlays.Overlay;
import bisq.desktop.util.FormBuilder;
import bisq.core.app.BisqEnvironment;
import bisq.core.btc.BaseCurrencyNetwork;
import bisq.core.locale.Res;
import bisq.common.app.DevEnv;
import javax.inject.Inject;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.geometry.Insets;
import javafx.collections.FXCollections;
import javafx.util.StringConverter;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import static bisq.desktop.util.FormBuilder.addMultilineLabel;
public class SelectBaseCurrencyWindow extends Overlay<SelectBaseCurrencyWindow> {
private ComboBox<BaseCurrencyNetwork> comboBox;
private Optional<Consumer<BaseCurrencyNetwork>> selectHandlerOptional;
///////////////////////////////////////////////////////////////////////////////////////////
// Public API
///////////////////////////////////////////////////////////////////////////////////////////
@Inject
public SelectBaseCurrencyWindow() {
type = Type.Confirmation;
}
public void show() {
if (headLine == null)
headLine = Res.get("selectBaseCurrencyWindow.headline");
width = 768;
createGridPane();
addHeadLine();
addContent();
addButtons();
applyStyles();
display();
}
public SelectBaseCurrencyWindow onSelect(Consumer<BaseCurrencyNetwork> selectHandler) {
this.selectHandlerOptional = Optional.of(selectHandler);
return this;
}
///////////////////////////////////////////////////////////////////////////////////////////
// Protected
///////////////////////////////////////////////////////////////////////////////////////////
private void addContent() {
Label label = addMultilineLabel(gridPane, ++rowIndex, Res.get("selectBaseCurrencyWindow.msg", BisqEnvironment.getBaseCurrencyNetwork().getCurrencyName()), 10);
GridPane.setMargin(label, new Insets(0, 0, 10, 0));
comboBox = FormBuilder.addComboBox(gridPane, ++rowIndex, Res.get("selectBaseCurrencyWindow.select"));
comboBox.setPromptText(Res.get("shared.select"));
List<BaseCurrencyNetwork> baseCurrencyNetworks = Arrays.asList(BaseCurrencyNetwork.values());
// show ony mainnet in production version
if (!DevEnv.isDevMode())
baseCurrencyNetworks = baseCurrencyNetworks.stream()
.filter(BaseCurrencyNetwork::isMainnet)
.collect(Collectors.toList());
comboBox.setItems(FXCollections.observableArrayList(baseCurrencyNetworks));
comboBox.setConverter(new StringConverter<BaseCurrencyNetwork>() {
@Override
public String toString(BaseCurrencyNetwork baseCurrencyNetwork) {
return DevEnv.isDevMode() ? (baseCurrencyNetwork.getCurrencyName() + "_" + baseCurrencyNetwork.getNetwork()) :
baseCurrencyNetwork.getCurrencyName();
}
@Override
public BaseCurrencyNetwork fromString(String string) {
return null;
}
});
comboBox.setOnAction(event -> {
selectHandlerOptional.get().accept(comboBox.getSelectionModel().getSelectedItem());
hide();
});
}
}

View file

@ -225,8 +225,8 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
@Override
public String toString(BaseCurrencyNetwork baseCurrencyNetwork) {
return baseCurrencyNetwork != null ?
(baseCurrencyNetwork.getCurrencyName() + "_" + baseCurrencyNetwork.getNetwork())
: "";
Res.get(baseCurrencyNetwork.name()) :
Res.get("na");
}
@Override
@ -591,7 +591,6 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
// We allow switching to testnet to make it easier for users to test the testnet DAO version
baseCurrencyNetworks = baseCurrencyNetworks.stream()
.filter(BaseCurrencyNetwork::isBitcoin)
.filter(e -> !e.isRegtest())
.collect(Collectors.toList());
selectBaseCurrencyNetworkComboBox.setItems(FXCollections.observableArrayList(baseCurrencyNetworks));

View file

@ -173,7 +173,7 @@ public class GUIUtil {
//noinspection UnusedAssignment
String key = "miningFeeInfo";
//noinspection ConstantConditions,ConstantConditions
if (!DevEnv.isDevMode() && DontShowAgainLookup.showAgain(key) && BisqEnvironment.getBaseCurrencyNetwork().isBitcoin()) {
if (!DevEnv.isDevMode() && DontShowAgainLookup.showAgain(key)) {
new Popup<>().attention(Res.get("guiUtil.miningFeeInfo", String.valueOf(GUIUtil.feeService.getTxFeePerByte().value)))
.onClose(runnable)
.useIUnderstandButton()