From 4120aff03736e5b991ee58904d005b5c0ed8a39c Mon Sep 17 00:00:00 2001 From: Eirik0 Date: Thu, 30 May 2019 09:56:45 -0600 Subject: [PATCH] Use reserve key for transparent change when sending to Sapling --- src/wallet/asyncrpcoperation_sendmany.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/wallet/asyncrpcoperation_sendmany.cpp b/src/wallet/asyncrpcoperation_sendmany.cpp index 64a40f03c..9ebd553a7 100644 --- a/src/wallet/asyncrpcoperation_sendmany.cpp +++ b/src/wallet/asyncrpcoperation_sendmany.cpp @@ -386,11 +386,11 @@ bool AsyncRPCOperation_sendmany::main_impl() { // Set change address if we are using transparent funds // TODO: Should we just use fromtaddr_ as the change address? + CReserveKey keyChange(pwalletMain); if (isfromtaddr_) { LOCK2(cs_main, pwalletMain->cs_wallet); EnsureWalletIsUnlocked(); - CReserveKey keyChange(pwalletMain); CPubKey vchPubKey; bool ret = keyChange.GetReservedKey(vchPubKey); if (!ret) { @@ -460,8 +460,7 @@ bool AsyncRPCOperation_sendmany::main_impl() { // Build the transaction tx_ = builder_.Build().GetTxOrThrow(); - // TODO use CReserveKey keyChange if isfromtaddr_ - UniValue sendResult = SendTransaction(tx_, boost::none, testmode); + UniValue sendResult = SendTransaction(tx_, keyChange, testmode); set_result(sendResult); return true;