aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2011-04-12 17:31:31 -0400
committerGavin Andresen <gavinandresen@gmail.com>2011-04-12 17:31:31 -0400
commit485dda9774b574a82fd23dc9650dd2cbcab2a391 (patch)
treed8df066ef0d7f6fde81d38adf61cb514933ab705 /main.cpp
parentd89d456655f03159a32e6a4a9df22bfe02d403d6 (diff)
parent198fd7b0bd5a99db4e45009c422a66c0b1285767 (diff)
Merge branch 'listimmature' of /Users/gavin/src/gavin_btc
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/main.cpp b/main.cpp
index 1c2292badb..c7ae47f69e 100644
--- a/main.cpp
+++ b/main.cpp
@@ -411,18 +411,20 @@ int CWalletTx::GetRequestCount() const
return nRequests;
}
-void CWalletTx::GetAmounts(int64& nGenerated, list<pair<string, int64> >& listReceived,
+void CWalletTx::GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, list<pair<string, int64> >& listReceived,
list<pair<string, int64> >& listSent, int64& nFee, string& strSentAccount) const
{
- nGenerated = nFee = 0;
+ nGeneratedImmature = nGeneratedMature = nFee = 0;
listReceived.clear();
listSent.clear();
strSentAccount = strFromAccount;
if (IsCoinBase())
{
- if (GetDepthInMainChain() >= COINBASE_MATURITY)
- nGenerated = GetCredit();
+ if (GetBlocksToMaturity() > 0)
+ nGeneratedImmature = CTransaction::GetCredit();
+ else
+ nGeneratedMature = GetCredit();
return;
}
@@ -470,15 +472,15 @@ void CWalletTx::GetAccountAmounts(const string& strAccount, int64& nGenerated, i
{
nGenerated = nReceived = nSent = nFee = 0;
- int64 allGenerated, allFee;
- allGenerated = allFee = 0;
+ int64 allGeneratedImmature, allGeneratedMature, allFee;
+ allGeneratedImmature = allGeneratedMature = allFee = 0;
string strSentAccount;
list<pair<string, int64> > listReceived;
list<pair<string, int64> > listSent;
- GetAmounts(allGenerated, listReceived, listSent, allFee, strSentAccount);
+ GetAmounts(allGeneratedImmature, allGeneratedMature, listReceived, listSent, allFee, strSentAccount);
if (strAccount == "")
- nGenerated = allGenerated;
+ nGenerated = allGeneratedMature;
if (strAccount == strSentAccount)
{
foreach(const PAIRTYPE(string,int64)& s, listSent)