Wallet locking fixes for -DDEBUG_LOCKORDER

Compiling with -DDEBUG_LOCKORDER and running the qa/rpc-test/ regression
tests uncovered a couple of wallet methods that should (but didn't)
acquire the cs_wallet mutext.

I also changed the AssertLockHeld() routine print to stderr and
abort, instead of printing to debug.log and then assert()'ing.
It is annoying to look in debug.log to find out which
AssertLockHeld is failing.
This commit is contained in:
Gavin Andresen
2014-02-18 12:11:46 -05:00
parent 5c99323459
commit ca4cf5cff6
4 changed files with 31 additions and 23 deletions

View File

@@ -140,8 +140,9 @@ void AssertLockHeldInternal(const char *pszName, const char* pszFile, int nLine,
{
BOOST_FOREACH(const PAIRTYPE(void*, CLockLocation)&i, *lockstack)
if (i.first == cs) return;
LogPrintf("Lock %s not held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, LocksHeld());
assert(0);
fprintf(stderr, "Assertion failed: lock %s not held in %s:%i; locks held:\n%s",
pszName, pszFile, nLine, LocksHeld().c_str());
abort();
}
#endif /* DEBUG_LOCKORDER */