aboutsummaryrefslogtreecommitdiff
path: root/src/qt/paymentserver.cpp
diff options
context:
space:
mode:
authorSjors Provoost <sjors@sprovoost.nl>2018-01-23 17:56:15 +0100
committerSjors Provoost <sjors@sprovoost.nl>2018-01-23 17:56:15 +0100
commit596c44633fd03e76cc12f2fd37452e223ba43115 (patch)
tree44646cccab6cd1dd47b1a4036d6260d517d066cd /src/qt/paymentserver.cpp
parent44080a90a29292df96e92f22242785c5040000a1 (diff)
[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/qt/paymentserver.cpp')
-rw-r--r--src/qt/paymentserver.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp
index dc729649b8..bc69d4f945 100644
--- a/src/qt/paymentserver.cpp
+++ b/src/qt/paymentserver.cpp
@@ -643,8 +643,9 @@ void PaymentServer::fetchPaymentACK(CWallet* wallet, const SendCoinsRecipient& r
// use for change. Despite an actual payment and not change, this is a close match:
// it's the output type we use subject to privacy issues, but not restricted by what
// other software supports.
- wallet->LearnRelatedScripts(newKey, g_change_type);
- CTxDestination dest = GetDestinationForKey(newKey, g_change_type);
+ const OutputType change_type = g_change_type != OUTPUT_TYPE_NONE ? g_change_type : g_address_type;
+ wallet->LearnRelatedScripts(newKey, change_type);
+ CTxDestination dest = GetDestinationForKey(newKey, change_type);
wallet->SetAddressBook(dest, strAccount, "refund");
CScript s = GetScriptForDestination(dest);