Skip to content

Commit 43f7ca7

Browse files
random-zebraFuzzbawls
authored andcommitted
BUG: Guard access to tx.sapData in connectBlock
Github-Pull: #2064 Rebased-From: f62ac6c
1 parent c12ff2b commit 43f7ca7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/validation.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,8 +1670,10 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
16701670
UpdateCoins(tx, view, i == 0 ? undoDummy : blockundo.vtxundo.back(), pindex->nHeight);
16711671

16721672
// Sapling update tree
1673-
for(const OutputDescription &outputDescription : tx.sapData->vShieldedOutput) {
1674-
sapling_tree.append(outputDescription.cmu);
1673+
if (tx.IsShieldedTx() && !tx.sapData->vShieldedOutput.empty()) {
1674+
for(const OutputDescription &outputDescription : tx.sapData->vShieldedOutput) {
1675+
sapling_tree.append(outputDescription.cmu);
1676+
}
16751677
}
16761678

16771679
vPos.emplace_back(tx.GetHash(), pos);

0 commit comments

Comments
 (0)