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 #9573.
Assert that CWallet::SyncMetaData finds oldest transaction. #11074
pull BitonicEelis wants to merge 1 commits into bitcoin:master from BitonicEelis:syncassert changing 1 files +3 −0-
BitonicEelis commented at 1:35 PM on August 17, 2017: contributor
-
6c4042a5d0
Assert that CWallet::SyncMetaData finds oldest transaction.
This fixes one of the Clang static analyzer warnings mentioned in #9573.
- laanwj added the label Wallet on Aug 17, 2017
-
in src/wallet/wallet.cpp:573 in 6c4042a5d0
568 | @@ -569,6 +569,9 @@ void CWallet::SyncMetaData(std::pair<TxSpends::iterator, TxSpends::iterator> ran 569 | copyFrom = &mapWallet[hash]; 570 | } 571 | } 572 | + 573 | + assert(copyFrom);
promag commented at 11:30 PM on August 17, 2017:From what I've seen there is at least one element in the range:
TxSpends::iterator it = range.first; const CWalletTx* copyFrom = mapWallet[it->second]; for (; it != range.second; ++i) { ...Maybe this assert should come first:
assert(range.first != range.second);
BitonicEelis commented at 10:25 AM on August 18, 2017:That would not suffice to silence the analyzer, because copyFrom is also nullptr if the range is nonempty but n == nMinOrderPos in every iteration.
laanwj commented at 2:20 PM on November 9, 2017: memberutACK 6c4042a
laanwj merged this on Nov 9, 2017laanwj closed this on Nov 9, 2017laanwj referenced this in commit 99ec12666b on Nov 9, 2017BitonicEelis deleted the branch on Nov 9, 2017PastaPastaPasta referenced this in commit 8a50468b24 on Dec 22, 2019PastaPastaPasta referenced this in commit 7ad0f14afd on Jan 2, 2020PastaPastaPasta referenced this in commit 7c9d59b3be on Jan 4, 2020PastaPastaPasta referenced this in commit 5e3ecb4496 on Jan 12, 2020PastaPastaPasta referenced this in commit ea8f25a19a on Jan 12, 2020PastaPastaPasta referenced this in commit 2e5dab3279 on Jan 12, 2020PastaPastaPasta referenced this in commit a1a67602e2 on Jan 12, 2020PastaPastaPasta referenced this in commit bab59f667d on Jan 12, 2020PastaPastaPasta referenced this in commit 2b8c9136e2 on Jan 12, 2020PastaPastaPasta referenced this in commit 0f6907e36c on Jan 16, 2020PastaPastaPasta referenced this in commit 134392f421 on Jan 22, 2020PastaPastaPasta referenced this in commit f738a1176e on Jan 29, 2020PastaPastaPasta referenced this in commit ba85a7f86d on Jan 29, 2020deadalnix referenced this in commit 61fa035c75 on Mar 5, 2020ftrader referenced this in commit 41a71b7274 on May 19, 2020ckti referenced this in commit 38707ca5da on Mar 28, 2021DrahtBot locked this on Sep 8, 2021ContributorsLabels
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 21:15 UTC
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 21:15 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me