aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpcwallet.cpp
diff options
context:
space:
mode:
authorSjors Provoost <[email protected]>2018-01-23 17:56:15 +0100
committerSjors Provoost <[email protected]>2018-01-23 17:56:15 +0100
commit596c44633fd03e76cc12f2fd37452e223ba43115 (patch)
tree44646cccab6cd1dd47b1a4036d6260d517d066cd /src/wallet/rpcwallet.cpp
parentMerge #12118: Sort mempool by min(feerate, ancestor_feerate) (diff)
downloaddiscoin-596c44633fd03e76cc12f2fd37452e223ba43115.tar.xz
discoin-596c44633fd03e76cc12f2fd37452e223ba43115.zip
[wallet] use P2WPKH change output if any destination is P2WPKH or P2WSH
Only if -changetype is not set and -addresstype is not "legacy".
Diffstat (limited to 'src/wallet/rpcwallet.cpp')
-rw-r--r--src/wallet/rpcwallet.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index e307623fd..59653721c 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -256,9 +256,9 @@ UniValue getrawchangeaddress(const JSONRPCRequest& request)
pwallet->TopUpKeyPool();
}
- OutputType output_type = g_change_type;
+ OutputType output_type = g_change_type != OUTPUT_TYPE_NONE ? g_change_type : g_address_type;
if (!request.params[0].isNull()) {
- output_type = ParseOutputType(request.params[0].get_str(), g_change_type);
+ output_type = ParseOutputType(request.params[0].get_str(), output_type);
if (output_type == OUTPUT_TYPE_NONE) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Unknown address type '%s'", request.params[0].get_str()));
}