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:
gavinandresen
2010-12-16 01:06:03 +00:00
parent 629e37dde1
commit 809ee79592
7 changed files with 282 additions and 140 deletions

36
main.h
View File

@@ -873,36 +873,11 @@ public:
return nChangeCached;
}
void GetAccountAmounts(string strAccount, const set<CScript>& setPubKey,
int64& nGenerated, int64& nReceived, int64& nSent, int64& nFee) const
{
nGenerated = nReceived = nSent = nFee = 0;
void GetAmounts(int64& nGenerated, list<pair<string /* address */, int64> >& listReceived,
int64& nSent, int64& nFee, string& strSentAccount) const;
// Generated blocks count to account ""
if (IsCoinBase())
{
if (strAccount == "" && GetBlocksToMaturity() == 0)
nGenerated = GetCredit();
return;
}
// Received
foreach(const CTxOut& txout, vout)
if (setPubKey.count(txout.scriptPubKey))
nReceived += txout.nValue;
// Sent
if (strFromAccount == strAccount)
{
int64 nDebit = GetDebit();
if (nDebit > 0)
{
int64 nValueOut = GetValueOut();
nFee = nDebit - nValueOut;
nSent = nValueOut - GetChange();
}
}
}
void GetAccountAmounts(const string& strAccount, int64& nGenerated, int64& nReceived,
int64& nSent, int64& nFee) const;
bool IsFromMe() const
{
@@ -1695,6 +1670,7 @@ public:
class CAccountingEntry
{
public:
string strAccount;
int64 nCreditDebit;
int64 nTime;
string strOtherAccount;
@@ -1709,6 +1685,7 @@ public:
{
nCreditDebit = 0;
nTime = 0;
strAccount.clear();
strOtherAccount.clear();
strComment.clear();
}
@@ -1717,6 +1694,7 @@ public:
(
if (!(nType & SER_GETHASH))
READWRITE(nVersion);
// Note: strAccount is serialized as part of the key, not here.
READWRITE(nCreditDebit);
READWRITE(nTime);
READWRITE(strOtherAccount);