From 198fd7b0bd5a99db4e45009c422a66c0b1285767 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Sun, 27 Mar 2011 14:56:18 -0400 Subject: Report immature coinbase transactions in listtransactions Report coin generation transactions as 'category':'immature' until they have 120 confirmations (when they are reported as 'category':'generate', as before). If the block they are in is not part of the main chain (you lost a 'block race'), then they are reported as 'category':'orphan' (with 0 confirmations). --- main.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 6bd90a32a..cd4f92eab 100644 --- a/main.cpp +++ b/main.cpp @@ -407,18 +407,20 @@ int CWalletTx::GetRequestCount() const return nRequests; } -void CWalletTx::GetAmounts(int64& nGenerated, list >& listReceived, +void CWalletTx::GetAmounts(int64& nGeneratedImmature, int64& nGeneratedMature, list >& listReceived, list >& 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; } @@ -466,15 +468,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 > listReceived; list > 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) -- cgit v1.2.3