From 09060cfe0d7cceb507a59b49a440275894defca0 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Mon, 14 Mar 2016 16:15:29 +0100 Subject: [PATCH] Fix caching of blinding data --- src/wallet/wallet.cpp | 9 +++++++++ src/wallet/wallet.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index c4a0a40536..76e2d37cff 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3823,3 +3823,12 @@ void CWallet::ComputeBlindingData(const CTxOut& output, CAmount& amount, CPubKey pubkey = CPubKey(); blindingfactor.SetNull(); } + +void CWalletTx::WipeUnknownBlindingData() const +{ + for (unsigned int n = 0; n < vout.size(); n++) { + if (GetValueOut(n) == -1) { + mapValue["blindingdata"][74 * n] = 0; + } + } +} diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 861ded559f..bb779fa457 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -372,6 +372,7 @@ public: fImmatureWatchCreditCached = false; fDebitCached = false; fChangeCached = false; + WipeUnknownBlindingData(); } void BindWallet(CWallet *pwalletIn) @@ -417,6 +418,7 @@ public: private: void GetBlindingData(unsigned int nOut, CAmount* pamountOut, CPubKey* ppubkeyOut, uint256* pblindingfactorOut) const; + void WipeUnknownBlindingData() const; public: //! Returns either the value out (if it is to us) or 0