New RPC command: listaccounts. New RPC setting -rpctimeout. And listtransactions '*'
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@203 1a98c847-1fd6-4fd8-948a-caf3550aa51b
This commit is contained in:
16
db.cpp
16
db.cpp
@@ -592,9 +592,9 @@ bool CWalletDB::WriteAccount(const string& strAccount, const CAccount& account)
|
||||
return Write(make_pair(string("acc"), strAccount), account);
|
||||
}
|
||||
|
||||
bool CWalletDB::WriteAccountingEntry(const string& strAccount, const CAccountingEntry& acentry)
|
||||
bool CWalletDB::WriteAccountingEntry(const CAccountingEntry& acentry)
|
||||
{
|
||||
return Write(make_tuple(string("acentry"), strAccount, ++nAccountingEntryNumber), acentry);
|
||||
return Write(make_tuple(string("acentry"), acentry.strAccount, ++nAccountingEntryNumber), acentry);
|
||||
}
|
||||
|
||||
int64 CWalletDB::GetAccountCreditDebit(const string& strAccount)
|
||||
@@ -613,6 +613,8 @@ void CWalletDB::ListAccountCreditDebit(const string& strAccount, list<CAccountin
|
||||
{
|
||||
int64 nCreditDebit = 0;
|
||||
|
||||
bool fAllAccounts = (strAccount == "*");
|
||||
|
||||
Dbc* pcursor = GetCursor();
|
||||
if (!pcursor)
|
||||
throw runtime_error("CWalletDB::ListAccountCreditDebit() : cannot create DB cursor");
|
||||
@@ -622,7 +624,7 @@ void CWalletDB::ListAccountCreditDebit(const string& strAccount, list<CAccountin
|
||||
// Read next record
|
||||
CDataStream ssKey;
|
||||
if (fFlags == DB_SET_RANGE)
|
||||
ssKey << make_tuple(string("acentry"), strAccount, uint64(0));
|
||||
ssKey << make_tuple(string("acentry"), (fAllAccounts? string("") : strAccount), uint64(0));
|
||||
CDataStream ssValue;
|
||||
int ret = ReadAtCursor(pcursor, ssKey, ssValue, fFlags);
|
||||
fFlags = DB_NEXT;
|
||||
@@ -639,12 +641,11 @@ void CWalletDB::ListAccountCreditDebit(const string& strAccount, list<CAccountin
|
||||
ssKey >> strType;
|
||||
if (strType != "acentry")
|
||||
break;
|
||||
string strAccountName;
|
||||
ssKey >> strAccountName;
|
||||
if (strAccountName != strAccount)
|
||||
CAccountingEntry acentry;
|
||||
ssKey >> acentry.strAccount;
|
||||
if (!fAllAccounts && acentry.strAccount != strAccount)
|
||||
break;
|
||||
|
||||
CAccountingEntry acentry;
|
||||
ssValue >> acentry;
|
||||
entries.push_back(acentry);
|
||||
}
|
||||
@@ -652,6 +653,7 @@ void CWalletDB::ListAccountCreditDebit(const string& strAccount, list<CAccountin
|
||||
pcursor->close();
|
||||
}
|
||||
|
||||
|
||||
bool CWalletDB::LoadWallet()
|
||||
{
|
||||
vchDefaultKey.clear();
|
||||
|
||||
Reference in New Issue
Block a user