aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2019-10-02 17:35:47 +0200
committerWladimir J. van der Laan <laanwj@protonmail.com>2019-10-02 17:46:01 +0200
commitfecc1be23143476b981352e8516cf9cce0450d62 (patch)
tree7fddddf7b4841918b025a4b855ea49870c523d1f
parentccaef6c28b1997bd40faad2e1c66e22cdda11edc (diff)
parent71d4eddf42eb5a15e434d2273f11d0a3942ef502 (diff)
Merge #16884: wallet: Change default address type to bech32
71d4eddf42eb5a15e434d2273f11d0a3942ef502 Add release note for bech32 by default in wallet (Gregory Sanders) b34f0180e39fc95d88596a987724b994707e2552 Revert "gui: Generate bech32 addresses by default (take 2, fixup)" (Gregory Sanders) f50785ab56c0c094960c7049cfe9209b101e2823 Change default address type to bech32 (Gregory Sanders) Pull request description: ACKs for top commit: MarcoFalke: re-ACK 71d4eddf42eb5a15e434d2273f11d0a3942ef502 (only change is restore mimick behavior) laanwj: ACK 71d4eddf42eb5a15e434d2273f11d0a3942ef502 Tree-SHA512: 3c49a1b51c49f3a762ad08985167ca1b89b0177ae20ab6d5883f1f74dde7a155921c1b855a842199bbf32f563c56b33f8b603bc842637bdcb121001023d454b6
-rw-r--r--doc/release-notes-16884.md2
-rw-r--r--src/interfaces/node.cpp1
-rw-r--r--src/interfaces/node.h3
-rw-r--r--src/qt/receivecoinsdialog.cpp13
-rw-r--r--src/wallet/wallet.h2
-rwxr-xr-xtest/functional/feature_bip68_sequence.py5
-rwxr-xr-xtest/functional/feature_rbf.py2
-rwxr-xr-xtest/functional/wallet_address_types.py2
-rwxr-xr-xtest/functional/wallet_basic.py2
-rwxr-xr-xtest/functional/wallet_bumpfee.py1
-rwxr-xr-xtest/functional/wallet_import_with_label.py4
11 files changed, 16 insertions, 21 deletions
diff --git a/doc/release-notes-16884.md b/doc/release-notes-16884.md
new file mode 100644
index 0000000000..e721080397
--- /dev/null
+++ b/doc/release-notes-16884.md
@@ -0,0 +1,2 @@
+The wallet now by default uses bech32 addresses when using RPC, and creates native segwit
+change outputs.
diff --git a/src/interfaces/node.cpp b/src/interfaces/node.cpp
index c80a8789fc..3d89e17163 100644
--- a/src/interfaces/node.cpp
+++ b/src/interfaces/node.cpp
@@ -201,7 +201,6 @@ public:
return GuessVerificationProgress(Params().TxData(), tip);
}
bool isInitialBlockDownload() override { return ::ChainstateActive().IsInitialBlockDownload(); }
- bool isAddressTypeSet() override { return !::gArgs.GetArg("-addresstype", "").empty(); }
bool getReindex() override { return ::fReindex; }
bool getImporting() override { return ::fImporting; }
void setNetworkActive(bool active) override
diff --git a/src/interfaces/node.h b/src/interfaces/node.h
index 2f4f396e72..688ff434ba 100644
--- a/src/interfaces/node.h
+++ b/src/interfaces/node.h
@@ -155,9 +155,6 @@ public:
//! Is initial block download.
virtual bool isInitialBlockDownload() = 0;
- //! Is -addresstype set.
- virtual bool isAddressTypeSet() = 0;
-
//! Get reindex.
virtual bool getReindex() = 0;
diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp
index df8d5115d5..de453cf743 100644
--- a/src/qt/receivecoinsdialog.cpp
+++ b/src/qt/receivecoinsdialog.cpp
@@ -7,7 +7,6 @@
#include <qt/receivecoinsdialog.h>
#include <qt/forms/ui_receivecoinsdialog.h>
-#include <interfaces/node.h>
#include <qt/addresstablemodel.h>
#include <qt/optionsmodel.h>
#include <qt/platformstyle.h>
@@ -93,16 +92,10 @@ void ReceiveCoinsDialog::setModel(WalletModel *_model)
// Last 2 columns are set by the columnResizingFixer, when the table geometry is ready.
columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH, this);
- if (model->node().isAddressTypeSet()) {
- // user explicitly set the type, use it
- if (model->wallet().getDefaultAddressType() == OutputType::BECH32) {
- ui->useBech32->setCheckState(Qt::Checked);
- } else {
- ui->useBech32->setCheckState(Qt::Unchecked);
- }
- } else {
- // Always fall back to bech32 in the gui
+ if (model->wallet().getDefaultAddressType() == OutputType::BECH32) {
ui->useBech32->setCheckState(Qt::Checked);
+ } else {
+ ui->useBech32->setCheckState(Qt::Unchecked);
}
// Set the button to be enabled or disabled based on whether the wallet can give out new addresses.
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 3428e8e001..9fc089126d 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -120,7 +120,7 @@ enum WalletFeature
};
//! Default for -addresstype
-constexpr OutputType DEFAULT_ADDRESS_TYPE{OutputType::P2SH_SEGWIT};
+constexpr OutputType DEFAULT_ADDRESS_TYPE{OutputType::BECH32};
//! Default for -changetype
constexpr OutputType DEFAULT_CHANGE_TYPE{OutputType::CHANGE_AUTO};
diff --git a/test/functional/feature_bip68_sequence.py b/test/functional/feature_bip68_sequence.py
index fe6f9eade1..677362756c 100755
--- a/test/functional/feature_bip68_sequence.py
+++ b/test/functional/feature_bip68_sequence.py
@@ -29,9 +29,10 @@ NOT_FINAL_ERROR = "non-BIP68-final (code 64)"
class BIP68Test(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
+ # TODO remove output type argument and fix resulting "tx-size-small" errors
self.extra_args = [
- ["-acceptnonstdtxn=1"],
- ["-acceptnonstdtxn=0"],
+ ["-acceptnonstdtxn=1", "-addresstype=p2sh-segwit"],
+ ["-acceptnonstdtxn=0", "-addresstype=p2sh-segwit"],
]
def skip_test_if_missing_module(self):
diff --git a/test/functional/feature_rbf.py b/test/functional/feature_rbf.py
index fd79df0b07..a1d4ce4c73 100755
--- a/test/functional/feature_rbf.py
+++ b/test/functional/feature_rbf.py
@@ -65,6 +65,7 @@ def make_utxo(node, amount, confirmed=True, scriptPubKey=CScript([1])):
class ReplaceByFeeTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
+ # TODO remove output type argument and fix resulting "tx-size-small" errors
self.extra_args = [
[
"-acceptnonstdtxn=1",
@@ -73,6 +74,7 @@ class ReplaceByFeeTest(BitcoinTestFramework):
"-limitancestorsize=101",
"-limitdescendantcount=200",
"-limitdescendantsize=101",
+ "-addresstype=p2sh-segwit",
],
]
diff --git a/test/functional/wallet_address_types.py b/test/functional/wallet_address_types.py
index c41b31e2e1..b72f5c6008 100755
--- a/test/functional/wallet_address_types.py
+++ b/test/functional/wallet_address_types.py
@@ -345,7 +345,7 @@ class AddressTypeTest(BitcoinTestFramework):
self.sync_blocks()
assert_equal(self.nodes[4].getbalance(), 1)
- self.log.info("Nodes with addresstype=legacy never use a P2WPKH change output")
+ self.log.info("Nodes with addresstype=legacy never use a P2WPKH change output (unless changetype is set otherwise):")
self.test_change_output_type(0, [to_address_bech32_1], 'legacy')
self.log.info("Nodes with addresstype=p2sh-segwit only use a P2WPKH change output if any destination address is bech32:")
diff --git a/test/functional/wallet_basic.py b/test/functional/wallet_basic.py
index 96ea5c9c35..550037923e 100755
--- a/test/functional/wallet_basic.py
+++ b/test/functional/wallet_basic.py
@@ -317,7 +317,7 @@ class WalletTest(BitcoinTestFramework):
assert_raises_rpc_error(-5, "Invalid private key encoding", self.nodes[0].importprivkey, "invalid")
# This will raise an exception for importing an address with the PS2H flag
- temp_address = self.nodes[1].getnewaddress()
+ temp_address = self.nodes[1].getnewaddress("", "p2sh-segwit")
assert_raises_rpc_error(-5, "Cannot use the p2sh flag with an address - use a script instead", self.nodes[0].importaddress, temp_address, "label", False, True)
# This will raise an exception for attempting to dump the private key of an address you do not own
diff --git a/test/functional/wallet_bumpfee.py b/test/functional/wallet_bumpfee.py
index 89838ff058..0948d47653 100755
--- a/test/functional/wallet_bumpfee.py
+++ b/test/functional/wallet_bumpfee.py
@@ -38,6 +38,7 @@ class BumpFeeTest(BitcoinTestFramework):
"-walletrbf={}".format(i),
"-mintxfee=0.00002",
"-deprecatedrpc=totalFee",
+ "-addresstype=p2sh-segwit", # TODO update constants in test and remove
] for i in range(self.num_nodes)]
def skip_test_if_missing_module(self):
diff --git a/test/functional/wallet_import_with_label.py b/test/functional/wallet_import_with_label.py
index a623b75606..2a9051b1e8 100755
--- a/test/functional/wallet_import_with_label.py
+++ b/test/functional/wallet_import_with_label.py
@@ -100,8 +100,8 @@ class ImportWithLabel(BitcoinTestFramework):
"Test importprivkey won't label new dests with the same "
"label as others labeled dests for the same key."
)
- self.log.info("Import a watch-only legacy address with a label.")
- address4 = self.nodes[0].getnewaddress()
+ self.log.info("Import a watch-only p2sh-segwit address with a label.")
+ address4 = self.nodes[0].getnewaddress("", "p2sh-segwit")
label4_addr = "Test Label 4 for importaddress"
self.nodes[1].importaddress(address4, label4_addr)
test_address(self.nodes[1],