Skip to content

Commit

Permalink
SSPKM: remove redundant ReadBlockFromDisk from IncrementNoteWitnesses.
Browse files Browse the repository at this point in the history
On the latest BlockConnected/BlockDisconnected flow, the block cannot be null.
  • Loading branch information
furszy committed Mar 10, 2021
1 parent 4ccec74 commit 9720579
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/sapling/saplingscriptpubkeyman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void UpdateWitnessHeights(NoteDataMap& noteDataMap, int indexHeight, int64_t nWi
}

void SaplingScriptPubKeyMan::IncrementNoteWitnesses(const CBlockIndex* pindex,
const CBlock* pblockIn,
const CBlock* pblock,
SaplingMerkleTree& saplingTree)
{
LOCK(wallet->cs_wallet);
Expand All @@ -217,17 +217,6 @@ void SaplingScriptPubKeyMan::IncrementNoteWitnesses(const CBlockIndex* pindex,
nWitnessCacheNeedsUpdate = true;
}

const CBlock* pblock {pblockIn};
CBlock block;
if (!pblock) {
if (!ReadBlockFromDisk(block, pindex)) {
std::string read_failed_str = strprintf("Unable to read block %d (%s) from disk.",
pindex->nHeight, pindex->GetBlockHash().ToString());
throw std::runtime_error(read_failed_str);
}
pblock = █
}

for (const auto& tx : pblock->vtx) {
if (!tx->IsShieldedTx()) continue;

Expand Down

0 comments on commit 9720579

Please sign in to comment.