diff --git a/qa/rpc-tests/test_framework/util.py b/qa/rpc-tests/test_framework/util.py --- a/qa/rpc-tests/test_framework/util.py +++ b/qa/rpc-tests/test_framework/util.py @@ -211,6 +211,7 @@ f.write("port=" + str(p2p_port(n)) + "\n") f.write("rpcport=" + str(rpc_port(n)) + "\n") f.write("listenonion=0\n") + f.write("usecashaddr=1\n") return datadir diff --git a/src/base58.h b/src/base58.h --- a/src/base58.h +++ b/src/base58.h @@ -17,6 +17,8 @@ #define BITCOIN_BASE58_H #include "chainparams.h" +// key.h and pubkey.h are not used here, but gcc doesn't want to instantiate +// CTxDestination if types are unknown #include "key.h" #include "pubkey.h" #include "script/standard.h" diff --git a/src/base58.cpp b/src/base58.cpp --- a/src/base58.cpp +++ b/src/base58.cpp @@ -257,7 +257,6 @@ } return CNoDestination(); } -} // namespace } // namespace diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -1575,6 +1575,8 @@ } } + config.SetCashAddrEncoding( + GetBoolArg("-usecashaddr", DEFAULT_USE_CASHADDR)); return true; } diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -65,6 +65,8 @@ static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000; static const bool DEFAULT_WALLETBROADCAST = true; static const bool DEFAULT_DISABLE_WALLET = false; +//! if set, all addresses will be encoded with cashaddr instead of base58 +static const bool DEFAULT_USE_CASHADDR = false; //! if set, all keys will be derived by using BIP32 static const bool DEFAULT_USE_HD_WALLET = true; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3958,6 +3958,10 @@ "so transactions begin confirmation on " "average within n blocks (default: %u)"), DEFAULT_TX_CONFIRM_TARGET)); + strUsage += HelpMessageOpt( + "-usecashaddr", strprintf(_("Use Cash Address for destination encoding " + "instead of base58 (default %d)"), + DEFAULT_USE_CASHADDR)); strUsage += HelpMessageOpt( "-usehd", _("Use hierarchical deterministic key generation (HD) after BIP32. "