Sanitize assert usage and refuse to compile with NDEBUG.

There were quite a few places where assert() was used with side effects,
 making operation with NDEBUG non-functional.  This commit fixes all the
 cases I know about, but also adds an  #error on NDEBUG because the code
 is untested without assertions and may still have vulnerabilities if
 used without assert.
This commit is contained in:
Gregory Maxwell
2013-12-02 11:33:44 -08:00
parent 9ab7a0609e
commit 9b59e3bda8
3 changed files with 23 additions and 7 deletions

View File

@@ -1298,7 +1298,9 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64_t> >& vecSend,
// Reserve a new key pair from key pool
CPubKey vchPubKey;
assert(reservekey.GetReservedKey(vchPubKey)); // should never fail, as we just unlocked
bool ret;
ret = reservekey.GetReservedKey(vchPubKey);
assert(ret); // should never fail, as we just unlocked
scriptChange.SetDestination(vchPubKey.GetID());
}