Use __func__ to get function name for output printing
This commit is contained in:
parent
7e5d94df1f
commit
fa785d1211
4 changed files with 21 additions and 21 deletions
|
@ -3954,7 +3954,7 @@ CBlockIndex * InsertBlockIndex(uint256 hash)
|
||||||
// Create new
|
// Create new
|
||||||
CBlockIndex* pindexNew = new CBlockIndex();
|
CBlockIndex* pindexNew = new CBlockIndex();
|
||||||
if (!pindexNew)
|
if (!pindexNew)
|
||||||
throw runtime_error("LoadBlockIndex(): new CBlockIndex failed");
|
throw runtime_error(std::string(__func__) + ": new CBlockIndex failed");
|
||||||
mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first;
|
mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first;
|
||||||
pindexNew->phashBlock = &((*mi).first);
|
pindexNew->phashBlock = &((*mi).first);
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ CAmount CTransaction::GetValueOut() const
|
||||||
{
|
{
|
||||||
nValueOut += it->nValue;
|
nValueOut += it->nValue;
|
||||||
if (!MoneyRange(it->nValue) || !MoneyRange(nValueOut))
|
if (!MoneyRange(it->nValue) || !MoneyRange(nValueOut))
|
||||||
throw std::runtime_error("CTransaction::GetValueOut(): value out of range");
|
throw std::runtime_error(std::string(__func__) + ": value out of range");
|
||||||
}
|
}
|
||||||
return nValueOut;
|
return nValueOut;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ CPubKey CWallet::GenerateNewKey()
|
||||||
|
|
||||||
// try to get the master key
|
// try to get the master key
|
||||||
if (!GetKey(hdChain.masterKeyID, key))
|
if (!GetKey(hdChain.masterKeyID, key))
|
||||||
throw std::runtime_error("CWallet::GenerateNewKey(): Master key not found");
|
throw std::runtime_error(std::string(__func__) + ": Master key not found");
|
||||||
|
|
||||||
masterKey.SetMaster(key.begin(), key.size());
|
masterKey.SetMaster(key.begin(), key.size());
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ CPubKey CWallet::GenerateNewKey()
|
||||||
|
|
||||||
// update the chain model in the database
|
// update the chain model in the database
|
||||||
if (!CWalletDB(strWalletFile).WriteHDChain(hdChain))
|
if (!CWalletDB(strWalletFile).WriteHDChain(hdChain))
|
||||||
throw std::runtime_error("CWallet::GenerateNewKey(): Writing HD chain model failed");
|
throw std::runtime_error(std::string(__func__) + ": Writing HD chain model failed");
|
||||||
} else {
|
} else {
|
||||||
secret.MakeNewKey(fCompressed);
|
secret.MakeNewKey(fCompressed);
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ CPubKey CWallet::GenerateNewKey()
|
||||||
nTimeFirstKey = nCreationTime;
|
nTimeFirstKey = nCreationTime;
|
||||||
|
|
||||||
if (!AddKeyPubKey(secret, pubkey))
|
if (!AddKeyPubKey(secret, pubkey))
|
||||||
throw std::runtime_error("CWallet::GenerateNewKey(): AddKey failed");
|
throw std::runtime_error(std::string(__func__) + ": AddKey failed");
|
||||||
return pubkey;
|
return pubkey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1094,7 +1094,7 @@ isminetype CWallet::IsMine(const CTxOut& txout) const
|
||||||
CAmount CWallet::GetCredit(const CTxOut& txout, const isminefilter& filter) const
|
CAmount CWallet::GetCredit(const CTxOut& txout, const isminefilter& filter) const
|
||||||
{
|
{
|
||||||
if (!MoneyRange(txout.nValue))
|
if (!MoneyRange(txout.nValue))
|
||||||
throw std::runtime_error("CWallet::GetCredit(): value out of range");
|
throw std::runtime_error(std::string(__func__) + ": value out of range");
|
||||||
return ((IsMine(txout) & filter) ? txout.nValue : 0);
|
return ((IsMine(txout) & filter) ? txout.nValue : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1123,7 +1123,7 @@ bool CWallet::IsChange(const CTxOut& txout) const
|
||||||
CAmount CWallet::GetChange(const CTxOut& txout) const
|
CAmount CWallet::GetChange(const CTxOut& txout) const
|
||||||
{
|
{
|
||||||
if (!MoneyRange(txout.nValue))
|
if (!MoneyRange(txout.nValue))
|
||||||
throw std::runtime_error("CWallet::GetChange(): value out of range");
|
throw std::runtime_error(std::string(__func__) + ": value out of range");
|
||||||
return (IsChange(txout) ? txout.nValue : 0);
|
return (IsChange(txout) ? txout.nValue : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1147,7 +1147,7 @@ CAmount CWallet::GetDebit(const CTransaction& tx, const isminefilter& filter) co
|
||||||
{
|
{
|
||||||
nDebit += GetDebit(txin, filter);
|
nDebit += GetDebit(txin, filter);
|
||||||
if (!MoneyRange(nDebit))
|
if (!MoneyRange(nDebit))
|
||||||
throw std::runtime_error("CWallet::GetDebit(): value out of range");
|
throw std::runtime_error(std::string(__func__) + ": value out of range");
|
||||||
}
|
}
|
||||||
return nDebit;
|
return nDebit;
|
||||||
}
|
}
|
||||||
|
@ -1159,7 +1159,7 @@ CAmount CWallet::GetCredit(const CTransaction& tx, const isminefilter& filter) c
|
||||||
{
|
{
|
||||||
nCredit += GetCredit(txout, filter);
|
nCredit += GetCredit(txout, filter);
|
||||||
if (!MoneyRange(nCredit))
|
if (!MoneyRange(nCredit))
|
||||||
throw std::runtime_error("CWallet::GetCredit(): value out of range");
|
throw std::runtime_error(std::string(__func__) + ": value out of range");
|
||||||
}
|
}
|
||||||
return nCredit;
|
return nCredit;
|
||||||
}
|
}
|
||||||
|
@ -1171,7 +1171,7 @@ CAmount CWallet::GetChange(const CTransaction& tx) const
|
||||||
{
|
{
|
||||||
nChange += GetChange(txout);
|
nChange += GetChange(txout);
|
||||||
if (!MoneyRange(nChange))
|
if (!MoneyRange(nChange))
|
||||||
throw std::runtime_error("CWallet::GetChange(): value out of range");
|
throw std::runtime_error(std::string(__func__) + ": value out of range");
|
||||||
}
|
}
|
||||||
return nChange;
|
return nChange;
|
||||||
}
|
}
|
||||||
|
@ -1200,7 +1200,7 @@ CPubKey CWallet::GenerateNewHDMasterKey()
|
||||||
|
|
||||||
// write the key&metadata to the database
|
// write the key&metadata to the database
|
||||||
if (!AddKeyPubKey(key, pubkey))
|
if (!AddKeyPubKey(key, pubkey))
|
||||||
throw std::runtime_error(std::string(__func__)+": AddKeyPubKey failed");
|
throw std::runtime_error(std::string(__func__) + ": AddKeyPubKey failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
return pubkey;
|
return pubkey;
|
||||||
|
@ -1227,7 +1227,7 @@ bool CWallet::SetHDChain(const CHDChain& chain, bool memonly)
|
||||||
{
|
{
|
||||||
LOCK(cs_wallet);
|
LOCK(cs_wallet);
|
||||||
if (!memonly && !CWalletDB(strWalletFile).WriteHDChain(chain))
|
if (!memonly && !CWalletDB(strWalletFile).WriteHDChain(chain))
|
||||||
throw runtime_error("AddHDChain(): writing chain failed");
|
throw runtime_error(std::string(__func__) + ": writing chain failed");
|
||||||
|
|
||||||
hdChain = chain;
|
hdChain = chain;
|
||||||
return true;
|
return true;
|
||||||
|
@ -2706,7 +2706,7 @@ bool CWallet::TopUpKeyPool(unsigned int kpSize)
|
||||||
if (!setKeyPool.empty())
|
if (!setKeyPool.empty())
|
||||||
nEnd = *(--setKeyPool.end()) + 1;
|
nEnd = *(--setKeyPool.end()) + 1;
|
||||||
if (!walletdb.WritePool(nEnd, CKeyPool(GenerateNewKey())))
|
if (!walletdb.WritePool(nEnd, CKeyPool(GenerateNewKey())))
|
||||||
throw runtime_error("TopUpKeyPool(): writing generated key failed");
|
throw runtime_error(std::string(__func__) + ": writing generated key failed");
|
||||||
setKeyPool.insert(nEnd);
|
setKeyPool.insert(nEnd);
|
||||||
LogPrintf("keypool added key %d, size=%u\n", nEnd, setKeyPool.size());
|
LogPrintf("keypool added key %d, size=%u\n", nEnd, setKeyPool.size());
|
||||||
}
|
}
|
||||||
|
@ -2733,9 +2733,9 @@ void CWallet::ReserveKeyFromKeyPool(int64_t& nIndex, CKeyPool& keypool)
|
||||||
nIndex = *(setKeyPool.begin());
|
nIndex = *(setKeyPool.begin());
|
||||||
setKeyPool.erase(setKeyPool.begin());
|
setKeyPool.erase(setKeyPool.begin());
|
||||||
if (!walletdb.ReadPool(nIndex, keypool))
|
if (!walletdb.ReadPool(nIndex, keypool))
|
||||||
throw runtime_error("ReserveKeyFromKeyPool(): read failed");
|
throw runtime_error(std::string(__func__) + ": read failed");
|
||||||
if (!HaveKey(keypool.vchPubKey.GetID()))
|
if (!HaveKey(keypool.vchPubKey.GetID()))
|
||||||
throw runtime_error("ReserveKeyFromKeyPool(): unknown key in key pool");
|
throw runtime_error(std::string(__func__) + ": unknown key in key pool");
|
||||||
assert(keypool.vchPubKey.IsValid());
|
assert(keypool.vchPubKey.IsValid());
|
||||||
LogPrintf("keypool reserve %d\n", nIndex);
|
LogPrintf("keypool reserve %d\n", nIndex);
|
||||||
}
|
}
|
||||||
|
@ -2794,7 +2794,7 @@ int64_t CWallet::GetOldestKeyPoolTime()
|
||||||
CWalletDB walletdb(strWalletFile);
|
CWalletDB walletdb(strWalletFile);
|
||||||
int64_t nIndex = *(setKeyPool.begin());
|
int64_t nIndex = *(setKeyPool.begin());
|
||||||
if (!walletdb.ReadPool(nIndex, keypool))
|
if (!walletdb.ReadPool(nIndex, keypool))
|
||||||
throw runtime_error("GetOldestKeyPoolTime(): read oldest key in keypool failed");
|
throw runtime_error(std::string(__func__) + ": read oldest key in keypool failed");
|
||||||
assert(keypool.vchPubKey.IsValid());
|
assert(keypool.vchPubKey.IsValid());
|
||||||
return keypool.nTime;
|
return keypool.nTime;
|
||||||
}
|
}
|
||||||
|
@ -3021,11 +3021,11 @@ void CWallet::GetAllReserveKeys(set<CKeyID>& setAddress) const
|
||||||
{
|
{
|
||||||
CKeyPool keypool;
|
CKeyPool keypool;
|
||||||
if (!walletdb.ReadPool(id, keypool))
|
if (!walletdb.ReadPool(id, keypool))
|
||||||
throw runtime_error("GetAllReserveKeyHashes(): read failed");
|
throw runtime_error(std::string(__func__) + ": read failed");
|
||||||
assert(keypool.vchPubKey.IsValid());
|
assert(keypool.vchPubKey.IsValid());
|
||||||
CKeyID keyID = keypool.vchPubKey.GetID();
|
CKeyID keyID = keypool.vchPubKey.GetID();
|
||||||
if (!HaveKey(keyID))
|
if (!HaveKey(keyID))
|
||||||
throw runtime_error("GetAllReserveKeyHashes(): unknown key in key pool");
|
throw runtime_error(std::string(__func__) + ": unknown key in key pool");
|
||||||
setAddress.insert(keyID);
|
setAddress.insert(keyID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3325,7 +3325,7 @@ bool CWallet::InitLoadWallet()
|
||||||
// generate a new master key
|
// generate a new master key
|
||||||
CPubKey masterPubKey = walletInstance->GenerateNewHDMasterKey();
|
CPubKey masterPubKey = walletInstance->GenerateNewHDMasterKey();
|
||||||
if (!walletInstance->SetHDMasterKey(masterPubKey))
|
if (!walletInstance->SetHDMasterKey(masterPubKey))
|
||||||
throw std::runtime_error("CWallet::GenerateNewKey(): Storing master key failed");
|
throw std::runtime_error(std::string(__func__) + ": Storing master key failed");
|
||||||
}
|
}
|
||||||
CPubKey newDefaultKey;
|
CPubKey newDefaultKey;
|
||||||
if (walletInstance->GetKeyFromPool(newDefaultKey)) {
|
if (walletInstance->GetKeyFromPool(newDefaultKey)) {
|
||||||
|
|
|
@ -215,7 +215,7 @@ void CWalletDB::ListAccountCreditDebit(const string& strAccount, list<CAccountin
|
||||||
|
|
||||||
Dbc* pcursor = GetCursor();
|
Dbc* pcursor = GetCursor();
|
||||||
if (!pcursor)
|
if (!pcursor)
|
||||||
throw runtime_error("CWalletDB::ListAccountCreditDebit(): cannot create DB cursor");
|
throw runtime_error(std::string(__func__) + ": cannot create DB cursor");
|
||||||
unsigned int fFlags = DB_SET_RANGE;
|
unsigned int fFlags = DB_SET_RANGE;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
@ -231,7 +231,7 @@ void CWalletDB::ListAccountCreditDebit(const string& strAccount, list<CAccountin
|
||||||
else if (ret != 0)
|
else if (ret != 0)
|
||||||
{
|
{
|
||||||
pcursor->close();
|
pcursor->close();
|
||||||
throw runtime_error("CWalletDB::ListAccountCreditDebit(): error scanning DB");
|
throw runtime_error(std::string(__func__) + ": error scanning DB");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unserialize
|
// Unserialize
|
||||||
|
|
Loading…
Reference in a new issue