mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-29 00:45:50 +01:00
[wallet] use P2WPKH change output if any destination is P2WPKH or P2WSH
Only if -changetype is not set and -addresstype is not "legacy".
This commit is contained in:
@@ -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()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user