Browse Source

Fix compile issue related to std::optional only being in c++17

witness_cache
Duke 7 months ago
parent
commit
7a58a3ae33
  1. 2
      src/wallet/wallet.cpp
  2. 4
      src/wallet/wallet.h

2
src/wallet/wallet.cpp

@ -1203,7 +1203,7 @@ void CWallet::BuildWitnessCache(const CBlockIndex* pindex, bool witnessOnly)
// so we stop updating their witnesses. This is safe to do because we know
// we won't roll back more than WITNESS_CACHE_SIZE blocks, since it is a
// number larger than the max reorg length
if (nd->spentHeight.has_value() && nd->spentHeight.value() + WITNESS_CACHE_SIZE < indexHeight) {
if (nd->spentHeight > 0 && nd->spentHeight + WITNESS_CACHE_SIZE < indexHeight) {
LogPrintf("%s: pruning witnesses for %s at indexHeight=%d with spentHeight=%d\n", __func__, nullifier.GetHex().c_str(), indexHeight, nd->spentHeight);
nd->witnesses.clear();
nd->witnessHeight = -1;

4
src/wallet/wallet.h

@ -295,7 +295,7 @@ public:
* CWallet::BuildWitnessCache and CWallet::DecrementNoteWitnesses.
*/
SaplingNoteData() : witnessHeight {-1}, nullifier(), spentHeight() { }
SaplingNoteData() : witnessHeight {-1}, nullifier(), spentHeight(-1) { }
SaplingNoteData(libzcash::SaplingIncomingViewingKey ivk) : ivk {ivk}, witnessHeight {-1}, nullifier() { }
SaplingNoteData(libzcash::SaplingIncomingViewingKey ivk, uint256 n) : ivk {ivk}, witnessHeight {-1}, nullifier(n) { }
@ -327,7 +327,7 @@ public:
* witnesses will continue to be updated, which is only a performance
* rather than a correctness issue).
*/
std::optional<int> spentHeight;
int spentHeight;
ADD_SERIALIZE_METHODS;

Loading…
Cancel
Save