mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-13 11:35:20 +01:00
Change default address type to bech32
This commit is contained in:
parent
ae3902ee3f
commit
f50785ab56
7 changed files with 11 additions and 7 deletions
|
@ -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};
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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",
|
||||
],
|
||||
]
|
||||
|
||||
|
|
|
@ -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:")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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],
|
||||
|
|
Loading…
Add table
Reference in a new issue