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
  1. BitonicEelis commented at 1:35 PM on August 17, 2017: contributor

    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.

  2. Assert that CWallet::SyncMetaData finds oldest transaction.
    This fixes one of the Clang static analyzer warnings mentioned in #9573.
    6c4042a5d0
  3. laanwj added the label Wallet on Aug 17, 2017
  4. 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.

  5. laanwj commented at 2:20 PM on November 9, 2017: member

    utACK 6c4042a

  6. laanwj merged this on Nov 9, 2017
  7. laanwj closed this on Nov 9, 2017

  8. laanwj referenced this in commit 99ec12666b on Nov 9, 2017
  9. BitonicEelis deleted the branch on Nov 9, 2017
  10. PastaPastaPasta referenced this in commit 8a50468b24 on Dec 22, 2019
  11. PastaPastaPasta referenced this in commit 7ad0f14afd on Jan 2, 2020
  12. PastaPastaPasta referenced this in commit 7c9d59b3be on Jan 4, 2020
  13. PastaPastaPasta referenced this in commit 5e3ecb4496 on Jan 12, 2020
  14. PastaPastaPasta referenced this in commit ea8f25a19a on Jan 12, 2020
  15. PastaPastaPasta referenced this in commit 2e5dab3279 on Jan 12, 2020
  16. PastaPastaPasta referenced this in commit a1a67602e2 on Jan 12, 2020
  17. PastaPastaPasta referenced this in commit bab59f667d on Jan 12, 2020
  18. PastaPastaPasta referenced this in commit 2b8c9136e2 on Jan 12, 2020
  19. PastaPastaPasta referenced this in commit 0f6907e36c on Jan 16, 2020
  20. PastaPastaPasta referenced this in commit 134392f421 on Jan 22, 2020
  21. PastaPastaPasta referenced this in commit f738a1176e on Jan 29, 2020
  22. PastaPastaPasta referenced this in commit ba85a7f86d on Jan 29, 2020
  23. deadalnix referenced this in commit 61fa035c75 on Mar 5, 2020
  24. ftrader referenced this in commit 41a71b7274 on May 19, 2020
  25. ckti referenced this in commit 38707ca5da on Mar 28, 2021
  26. DrahtBot locked this on Sep 8, 2021

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 site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me