Watchonly code: cs_main lock not held #4499

issue gavinandresen opened this issue on July 9, 2014
  1. gavinandresen commented at 4:41 PM on July 9, 2014: contributor

    Running Qt compiled with -DDEBUG_LOCKORDER, I'm getting:

    Assertion failed: lock cs_main not held in main.cpp:624; locks held:
    cs_wallet  wallet.cpp:1078
    

    ... call stack is:

    (lldb) up
    frame [#4](/bitcoin-bitcoin/4/): 0x0000000100287590 bitcoin-qt`IsFinalTx(tx=0x000000011cc9a5d0, nBlockHeight=0, nBlockTime=0) + 80 at main.cpp:624
       621
       622  bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
       623  {
    -> 624      AssertLockHeld(cs_main);
       625      // Time based nLockTime implemented in 0.1.6
       626      if (tx.nLockTime == 0)
       627          return true;
    (lldb) up
    frame [#5](/bitcoin-bitcoin/5/): 0x00000001006802af bitcoin-qt`CWalletTx::IsTrusted(this=0x000000011cc9a5d0) const + 63 at wallet.h:778
       775      bool IsTrusted() const
       776      {
       777          // Quick answer in most cases
    -> 778          if (!IsFinalTx(*this))
       779              return false;
       780          int nDepth = GetDepthInMainChain();
       781          if (nDepth >= 1)
    (lldb) up
    frame [#6](/bitcoin-bitcoin/6/): 0x00000001006c6cfd bitcoin-qt`CWallet::GetWatchOnlyBalance(this=0x000000011cc97da0) const + 765 at wallet.cpp:1082
       1079         for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
       1080         {
       1081             const CWalletTx* pcoin = &(*it).second;
    -> 1082             if (pcoin->IsTrusted())
       1083                 nTotal += pcoin->GetAvailableWatchOnlyCredit();
       1084         }
       1085     }
    
  2. laanwj closed this on Jul 14, 2014

  3. MarcoFalke 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 18:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me