move debug.log and db.log to data dir, portable GetDataDir, optimize GetBalance, fix repaint bogdown, -addnode and -? switches

This commit is contained in:
s_nakamoto
2009-11-01 01:16:51 +00:00
parent 99142385da
commit e66ec79b18
12 changed files with 415 additions and 381 deletions

20
main.h
View File

@@ -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