diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index cae002ac94..2bf27ae41f 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3166,15 +3166,17 @@ bool CWallet::CreateTransaction(const std::vector& vecSend, CTransac } std::vector::iterator position = txNew.vout.begin()+vChangePosInOut[assetChange.first]; - txNew.vout.insert(position, newTxOut); - CPubKey blind_pub = GetBlindingPubKey(itScript->second.second); if (blind_details) { + CPubKey blind_pub = GetBlindingPubKey(itScript->second.second); blind_details->o_pubkeys.insert(blind_details->o_pubkeys.begin() + vChangePosInOut[assetChange.first], blind_pub); assert(blind_pub.IsFullyValid()); blind_details->num_to_blind++; blind_details->change_to_blind++; blind_details->only_change_pos = vChangePosInOut[assetChange.first]; + // Place the blinding pubkey here in case of fundraw calls + newTxOut.nNonce.vchCommitment = std::vector(blind_pub.begin(), blind_pub.end()); } + txNew.vout.insert(position, newTxOut); } } // Set the correct nChangePosInOut for output. Should be policyAsset's position.