diff options
author | s_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b> | 2009-11-01 01:16:51 +0000 |
---|---|---|
committer | s_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b> | 2009-11-01 01:16:51 +0000 |
commit | 4ac57f013e20da2d0f87fff69625cbd4419089f3 (patch) | |
tree | 8120216e7ebfdc54244835dfa5650f1181b57025 /main.h | |
parent | 5750932cdf72ea9b5e64b8a05b43c42f5acb417d (diff) |
move debug.log and db.log to data dir, portable GetDataDir, optimize GetBalance, fix repaint bogdown, -addnode and -? switches
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@25 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'main.h')
-rw-r--r-- | main.h | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -34,7 +34,6 @@ extern int nBestHeight; extern uint256 hashBestChain;
extern CBlockIndex* pindexBest;
extern unsigned int nTransactionsUpdated;
-extern string strSetDataDir;
extern int nDropMessagesTest;
// Settings
@@ -50,7 +49,6 @@ extern int nLimitProcessors; -string GetAppDir();
bool CheckDiskSpace(int64 nAdditionalBytes=0);
FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode="rb");
FILE* AppendBlockFile(unsigned int& nFileRet);
@@ -405,10 +403,10 @@ public: {
// Time based nLockTime implemented in 0.1.6,
// do not use time based until most 0.1.5 nodes have upgraded.
- if (nBlockTime == 0)
- nBlockTime = GetAdjustedTime();
if (nLockTime == 0)
return true;
+ if (nBlockTime == 0)
+ nBlockTime = GetAdjustedTime();
if (nLockTime < (nLockTime < 500000000 ? nBestHeight : nBlockTime))
return true;
foreach(const CTxIn& txin, vin)
@@ -627,6 +625,8 @@ public: // memory only
mutable bool fMerkleVerified;
+ mutable bool fGetCreditCached;
+ mutable int64 nGetCreditCached;
CMerkleTx()
@@ -644,14 +644,22 @@ public: hashBlock = 0;
nIndex = -1;
fMerkleVerified = false;
+ fGetCreditCached = false;
+ nGetCreditCached = 0;
}
- int64 GetCredit() const
+ int64 GetCredit(bool fUseCache=false) const
{
// Must wait until coinbase is safely deep enough in the chain before valuing it
if (IsCoinBase() && GetBlocksToMaturity() > 0)
return 0;
- return CTransaction::GetCredit();
+
+ // GetBalance can assume transactions in mapWallet won't change
+ if (fUseCache && fGetCreditCached)
+ return nGetCreditCached;
+ nGetCreditCached = CTransaction::GetCredit();
+ fGetCreditCached = true;
+ return nGetCreditCached;
}
IMPLEMENT_SERIALIZE
|