Skip to content

Commit

Permalink
Use REGTEST as network for BTC_DAO_TESTNET
Browse files Browse the repository at this point in the history
- As teh network is used for filtering asset types BSQ has 3 asset
types, one per network we need to use REGTEST as network. The methods
for checking which BaseCurrencyNetwork are using name() now instead of
network as we have 2 times REGTEST.

- Fix bug with not calling showFeeInfoAndPublishMyProposal for bonded
role proposals.
  • Loading branch information
ManfredKarrer committed Feb 21, 2019
1 parent a24cf06 commit 0800301
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions core/src/main/java/bisq/core/btc/BaseCurrencyNetwork.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ 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_DAO_TESTNET(RegTestParams.get(), "BTC", "DAO_TESTNET", "Bitcoin"); // server side regtest
BTC_DAO_TESTNET(RegTestParams.get(), "BTC", "REGTEST", "Bitcoin"); // server side regtest

@Getter
private final NetworkParameters parameters;
Expand All @@ -47,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 "DAO_TESTNET".equals(network);
return "BTC_DAO_TESTNET".equals(name());
}

public boolean isRegtest() {
return "REGTEST".equals(network);
return "BTC_REGTEST".equals(name());
}

public long getDefaultMinFeePerByte() {
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/bisq/core/dao/governance/param/Param.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ public void onParseTxsCompleteAfterBatchProcessing(Block block) {
}



///////////////////////////////////////////////////////////////////////////////////////////
// Private
///////////////////////////////////////////////////////////////////////////////////////////
Expand All @@ -279,18 +278,20 @@ private void publishMyProposal(ProposalType type) {
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"))
.onAction(() -> {
showFeeInfoAndPublishMyProposal(proposal, transaction, miningFee, txSize, fee);
})
.show();
} else {
showFeeInfoAndPublishMyProposal(proposal, transaction, miningFee, txSize, fee);
}
} else {
showFeeInfoAndPublishMyProposal(proposal, transaction, miningFee, txSize, fee);
Expand Down Expand Up @@ -330,7 +331,6 @@ private void showFeeInfoAndPublishMyProposal(Proposal proposal, Transaction tran
}

private void doPublishMyProposal(Proposal proposal, Transaction transaction) {

busyLabel.setVisible(true);
busyAnimation.play();
makeProposalButton.setDisable(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ private void initializeGeneralOptions() {
@Override
public String toString(BaseCurrencyNetwork baseCurrencyNetwork) {
return baseCurrencyNetwork != null ?
(baseCurrencyNetwork.getCurrencyName() + "_" + baseCurrencyNetwork.getNetwork())
: "";
Res.get(baseCurrencyNetwork.name()) :
Res.get("na");
}

@Override
Expand Down

0 comments on commit 0800301

Please sign in to comment.