Skip to content

Commit

Permalink
Merge bitcoin#11074: Assert that CWallet::SyncMetaData finds oldest t…
Browse files Browse the repository at this point in the history
…ransaction.

6c4042a Assert that CWallet::SyncMetaData finds oldest transaction. (Eelis)

Pull request description:

  Without this assert, the Clang static analyzer warns about subsequent dereferencing of copyFrom, because it can't be sure that it's not nullptr. See bitcoin#9573.

Tree-SHA512: 83cbcb32c52c94fcfefbc90ec7de2011dacd6bdb0da35adc401b8d8dda6a86de2fa0403e2158592268c2cf15eef4f3d887d98c90f1031d4735d5f4bf9dbc1d23
  • Loading branch information
laanwj committed Nov 9, 2017
2 parents 77ba4bf + 6c4042a commit 99ec126
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,9 @@ void CWallet::SyncMetaData(std::pair<TxSpends::iterator, TxSpends::iterator> ran
copyFrom = &mapWallet[hash];
}
}

assert(copyFrom);

// Now copy data from copyFrom to rest:
for (TxSpends::iterator it = range.first; it != range.second; ++it)
{
Expand Down

0 comments on commit 99ec126

Please sign in to comment.