Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v1.6.5 #5541

Merged
merged 16 commits into from May 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -412,7 +412,7 @@ configure(project(':desktop')) {
modules = ['javafx.controls', 'javafx.fxml']
}

version = '1.6.4-SNAPSHOT'
version = '1.6.5-SNAPSHOT'

jar.manifest.attributes(
"Implementation-Title": project.name,
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/bisq/common/app/Version.java
Expand Up @@ -30,15 +30,15 @@ public class Version {
// VERSION = 0.5.0 introduces proto buffer for the P2P network and local DB and is a not backward compatible update
// Therefore all sub versions start again with 1
// We use semantic versioning with major, minor and patch
public static final String VERSION = "1.6.4";
public static final String VERSION = "1.6.5";

/**
* Holds a list of the tagged resource files for optimizing the getData requests.
* This must not contain each version but only those where we add new version-tagged resource files for
* historical data stores.
*/
public static final List<String> HISTORICAL_RESOURCE_FILE_VERSION_TAGS = Arrays.asList("1.4.0", "1.5.0", "1.5.2",
"1.5.5", "1.5.7", "1.6.0", "1.6.3");
"1.5.5", "1.5.7", "1.6.0", "1.6.3", "1.6.5");

public static int getMajorVersion(String version) {
return getSubVersion(version, 0);
Expand Down
5 changes: 3 additions & 2 deletions common/src/main/java/bisq/common/config/Config.java
Expand Up @@ -129,7 +129,8 @@ public class Config {
// Default values for certain options
public static final int UNSPECIFIED_PORT = -1;
public static final String DEFAULT_REGTEST_HOST = "localhost";
public static final int DEFAULT_NUM_CONNECTIONS_FOR_BTC = 9; // down from BitcoinJ default of 12
public static final int DEFAULT_NUM_CONNECTIONS_FOR_BTC_PROVIDED = 7; // down from BitcoinJ default of 12
public static final int DEFAULT_NUM_CONNECTIONS_FOR_BTC_PUBLIC = 9;
public static final boolean DEFAULT_FULL_DAO_NODE = false;
static final String DEFAULT_CONFIG_FILE_NAME = "bisq.properties";

Expand Down Expand Up @@ -550,7 +551,7 @@ public Config(String defaultAppName, File defaultUserDataDir, String... args) {
parser.accepts(NUM_CONNECTIONS_FOR_BTC, "Number of connections to the Bitcoin network")
.withRequiredArg()
.ofType(int.class)
.defaultsTo(DEFAULT_NUM_CONNECTIONS_FOR_BTC);
.defaultsTo(DEFAULT_NUM_CONNECTIONS_FOR_BTC_PROVIDED);

ArgumentAcceptingOptionSpec<String> rpcUserOpt =
parser.accepts(RPC_USER, "Bitcoind rpc username")
Expand Down
Expand Up @@ -19,7 +19,6 @@

import bisq.core.user.Preferences;

import bisq.common.config.Config;
import bisq.common.util.Utilities;

import java.util.Collections;
Expand All @@ -34,9 +33,12 @@ public class BtcNodesSetupPreferences {
private static final Logger log = LoggerFactory.getLogger(BtcNodesSetupPreferences.class);

private final Preferences preferences;
private final int numConnectionsForBtc;

public BtcNodesSetupPreferences(Preferences preferences) {
public BtcNodesSetupPreferences(Preferences preferences,
int numConnectionsForBtc) {
this.preferences = preferences;
this.numConnectionsForBtc = numConnectionsForBtc;
}

public List<BtcNodes.BtcNode> selectPreferredNodes(BtcNodes nodes) {
Expand Down Expand Up @@ -83,7 +85,7 @@ public int calculateMinBroadcastConnections(List<BtcNodes.BtcNode> nodes) {
break;
case PUBLIC:
// We keep the empty nodes
result = (int) Math.floor(Config.DEFAULT_NUM_CONNECTIONS_FOR_BTC * 0.8);
result = (int) Math.floor(numConnectionsForBtc * 0.8);
break;
case PROVIDED:
default:
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/bisq/core/btc/setup/WalletsSetup.java
Expand Up @@ -396,7 +396,8 @@ private void configPeerNodesForRegTestServer() {
}

private void configPeerNodes(@Nullable Socks5Proxy proxy) {
BtcNodesSetupPreferences btcNodesSetupPreferences = new BtcNodesSetupPreferences(preferences);
BtcNodesSetupPreferences btcNodesSetupPreferences = new BtcNodesSetupPreferences(preferences,
numConnectionsForBtc);

List<BtcNode> nodes = btcNodesSetupPreferences.selectPreferredNodes(btcNodes);
int minBroadcastConnections = btcNodesSetupPreferences.calculateMinBroadcastConnections(nodes);
Expand Down
45 changes: 22 additions & 23 deletions core/src/main/java/bisq/core/btc/wallet/BsqWalletService.java
Expand Up @@ -52,7 +52,6 @@
import org.bitcoinj.script.Script;
import org.bitcoinj.script.ScriptException;
import org.bitcoinj.wallet.CoinSelection;
import org.bitcoinj.wallet.CoinSelector;
import org.bitcoinj.wallet.SendRequest;

import javax.inject.Inject;
Expand Down Expand Up @@ -562,38 +561,38 @@ public Transaction getPreparedSendBtcTx(String receiverAddress,
return getPreparedSendTx(receiverAddress, receiverAmount, nonBsqCoinSelector);
}

private Transaction getPreparedSendTx(String receiverAddress, Coin receiverAmount, CoinSelector coinSelector)
private Transaction getPreparedSendTx(String receiverAddress,
Coin receiverAmount,
BisqDefaultCoinSelector coinSelector)
throws AddressFormatException, InsufficientBsqException, WalletException, TransactionVerificationException, BsqChangeBelowDustException {
daoKillSwitch.assertDaoIsNotDisabled();
Transaction tx = new Transaction(params);
checkArgument(Restrictions.isAboveDust(receiverAmount),
"The amount is too low (dust limit).");
tx.addOutput(receiverAmount, Address.fromString(params, receiverAddress));
SendRequest sendRequest = SendRequest.forTx(tx);
sendRequest.fee = Coin.ZERO;
sendRequest.feePerKb = Coin.ZERO;
sendRequest.ensureMinRequiredFee = false;
sendRequest.aesKey = aesKey;
sendRequest.shuffleOutputs = false;
sendRequest.signInputs = false;
sendRequest.changeAddress = getChangeAddress();
sendRequest.coinSelector = coinSelector;
try {
var selection = coinSelector.select(receiverAmount, wallet.calculateAllSpendCandidates());
var change = coinSelector.getChange(receiverAmount, selection);
if (Restrictions.isAboveDust(change)) {
tx.addOutput(change, getChangeAddress());
} else if (!change.isZero()) {
String msg = "BSQ change output is below dust limit. outputValue=" + change.value / 100 + " BSQ";
log.warn(msg);
throw new BsqChangeBelowDustException(msg, change);
}

SendRequest sendRequest = SendRequest.forTx(tx);
sendRequest.fee = Coin.ZERO;
sendRequest.feePerKb = Coin.ZERO;
sendRequest.ensureMinRequiredFee = false;
sendRequest.aesKey = aesKey;
sendRequest.shuffleOutputs = false;
sendRequest.signInputs = false;
sendRequest.changeAddress = getChangeAddress();
sendRequest.coinSelector = coinSelector;
wallet.completeTx(sendRequest);
checkWalletConsistency(wallet);
verifyTransaction(tx);
// printTx("prepareSendTx", tx);

// Tx has as first output BSQ and an optional second BSQ change output.
// At that stage we do not have added the BTC inputs so there is no BTC change output here.
if (tx.getOutputs().size() == 2) {
Coin bsqChangeOutputValue = tx.getOutputs().get(1).getValue();
if (!Restrictions.isAboveDust(bsqChangeOutputValue)) {
String msg = "BSQ change output is below dust limit. outputValue=" + bsqChangeOutputValue.value / 100 + " BSQ";
log.warn(msg);
throw new BsqChangeBelowDustException(msg, bsqChangeOutputValue);
}
}

return tx;
} catch (InsufficientMoneyException e) {
Expand Down