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 @@ -72,6 +72,8 @@ static const bool DEFAULT_REST_ENABLE = false; static const bool DEFAULT_DISABLE_SAFEMODE = false; static const bool DEFAULT_STOPAFTERBLOCKIMPORT = false; +//! if set, all addresses will be encoded with cashaddr instead of base58 +static const bool DEFAULT_USE_CASHADDR = false; std::unique_ptr g_connman; std::unique_ptr peerLogic; @@ -419,6 +421,10 @@ "-txindex", strprintf(_("Maintain a full transaction index, used by " "the getrawtransaction rpc call (default: %d)"), DEFAULT_TXINDEX)); + strUsage += HelpMessageOpt( + "-usecashaddr", strprintf(_("Use Cash Address for destination encoding " + "instead of base58 (default %d)"), + DEFAULT_USE_CASHADDR)); strUsage += HelpMessageGroup(_("Connection options:")); strUsage += HelpMessageOpt( @@ -1574,7 +1580,6 @@ } } } - return true; } @@ -2088,6 +2093,10 @@ if (!est_filein.IsNull()) mempool.ReadFeeEstimates(est_filein); fFeeEstimatesInitialized = true; + // Encoded addresses using cashaddr instead of base58 + config.SetCashAddrEncoding( + GetBoolArg("-usecashaddr", DEFAULT_USE_CASHADDR)); + // Step 8: load wallet #ifdef ENABLE_WALLET if (!CWallet::InitLoadWallet()) return false;