small changes in init, main, checkpoints.h and bitcoin-qt.pro

- remove an unneeded MODAL flag, as MSG_ERROR sets MODAL
- re-order an if-clause in main to have bool checks before a function call
- fix some log messages that used wrong function names
- make a log message use a correct ellipsis
- remove some unneded spaces, brackets and line-breaks
- fix style for adding files in the Qt project
This commit is contained in:
Philip Kaufmann 2013-01-18 15:07:05 +01:00
parent 44d7f4cbeb
commit 69e0774714
5 changed files with 19 additions and 23 deletions

View file

@ -206,7 +206,8 @@ HEADERS += src/qt/bitcoingui.h \
src/leveldb.h \ src/leveldb.h \
src/threadsafety.h src/threadsafety.h
SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \ SOURCES += src/qt/bitcoin.cpp \
src/qt/bitcoingui.cpp \
src/qt/transactiontablemodel.cpp \ src/qt/transactiontablemodel.cpp \
src/qt/addresstablemodel.cpp \ src/qt/addresstablemodel.cpp \
src/qt/optionsdialog.cpp \ src/qt/optionsdialog.cpp \
@ -270,11 +271,9 @@ SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \
src/leveldb.cpp \ src/leveldb.cpp \
src/txdb.cpp src/txdb.cpp
RESOURCES += \ RESOURCES += src/qt/bitcoin.qrc
src/qt/bitcoin.qrc
FORMS += \ FORMS += src/qt/forms/sendcoinsdialog.ui \
src/qt/forms/sendcoinsdialog.ui \
src/qt/forms/addressbookpage.ui \ src/qt/forms/addressbookpage.ui \
src/qt/forms/signverifymessagedialog.ui \ src/qt/forms/signverifymessagedialog.ui \
src/qt/forms/aboutdialog.ui \ src/qt/forms/aboutdialog.ui \

View file

@ -454,8 +454,7 @@ bool CTransaction::AreInputsStandard(CCoinsViewCache& mapInputs) const
return true; return true;
} }
unsigned int unsigned int CTransaction::GetLegacySigOpCount() const
CTransaction::GetLegacySigOpCount() const
{ {
unsigned int nSigOps = 0; unsigned int nSigOps = 0;
BOOST_FOREACH(const CTxIn& txin, vin) BOOST_FOREACH(const CTxIn& txin, vin)
@ -1176,7 +1175,7 @@ int GetNumBlocksOfPeers()
bool IsInitialBlockDownload() bool IsInitialBlockDownload()
{ {
if (pindexBest == NULL || nBestHeight < Checkpoints::GetTotalBlocksEstimate() || fReindex || fImporting) if (pindexBest == NULL || fImporting || fReindex || nBestHeight < Checkpoints::GetTotalBlocksEstimate())
return true; return true;
static int64 nLastUpdate; static int64 nLastUpdate;
static CBlockIndex* pindexLastBest; static CBlockIndex* pindexLastBest;
@ -1629,7 +1628,6 @@ bool CBlock::ConnectBlock(CValidationState &state, CBlockIndex* pindex, CCoinsVi
vPos.reserve(vtx.size()); vPos.reserve(vtx.size());
for (unsigned int i=0; i<vtx.size(); i++) for (unsigned int i=0; i<vtx.size(); i++)
{ {
const CTransaction &tx = vtx[i]; const CTransaction &tx = vtx[i];
nInputs += tx.vin.size(); nInputs += tx.vin.size();
@ -2444,7 +2442,7 @@ bool AbortNode(const std::string &strMessage) {
fRequestShutdown = true; fRequestShutdown = true;
strMiscWarning = strMessage; strMiscWarning = strMessage;
printf("*** %s\n", strMessage.c_str()); printf("*** %s\n", strMessage.c_str());
uiInterface.ThreadSafeMessageBox(strMessage, "", CClientUIInterface::MSG_ERROR | CClientUIInterface::MODAL); uiInterface.ThreadSafeMessageBox(strMessage, "", CClientUIInterface::MSG_ERROR);
StartShutdown(); StartShutdown();
return false; return false;
} }
@ -2543,9 +2541,9 @@ bool static LoadBlockIndexDB()
// Load block file info // Load block file info
pblocktree->ReadLastBlockFile(nLastBlockFile); pblocktree->ReadLastBlockFile(nLastBlockFile);
printf("LoadBlockIndex(): last block file = %i\n", nLastBlockFile); printf("LoadBlockIndexDB(): last block file = %i\n", nLastBlockFile);
if (pblocktree->ReadBlockFileInfo(nLastBlockFile, infoLastBlockFile)) if (pblocktree->ReadBlockFileInfo(nLastBlockFile, infoLastBlockFile))
printf("LoadBlockIndex(): last block file: %s\n", infoLastBlockFile.ToString().c_str()); printf("LoadBlockIndexDB(): last block file info: %s\n", infoLastBlockFile.ToString().c_str());
// Load bnBestInvalidWork, OK if it doesn't exist // Load bnBestInvalidWork, OK if it doesn't exist
pblocktree->ReadBestInvalidWork(bnBestInvalidWork); pblocktree->ReadBestInvalidWork(bnBestInvalidWork);
@ -2557,7 +2555,7 @@ bool static LoadBlockIndexDB()
// Check whether we have a transaction index // Check whether we have a transaction index
pblocktree->ReadFlag("txindex", fTxIndex); pblocktree->ReadFlag("txindex", fTxIndex);
printf("LoadBlockIndex(): transaction index %s\n", fTxIndex ? "enabled" : "disabled"); printf("LoadBlockIndexDB(): transaction index %s\n", fTxIndex ? "enabled" : "disabled");
// Load hashBestChain pointer to end of best chain // Load hashBestChain pointer to end of best chain
pindexBest = pcoinsTip->GetBestBlock(); pindexBest = pcoinsTip->GetBestBlock();
@ -2574,7 +2572,7 @@ bool static LoadBlockIndexDB()
pindexPrev->pnext = pindex; pindexPrev->pnext = pindex;
pindex = pindexPrev; pindex = pindexPrev;
} }
printf("LoadBlockIndex(): hashBestChain=%s height=%d date=%s\n", printf("LoadBlockIndexDB(): hashBestChain=%s height=%d date=%s\n",
BlockHashStr(hashBestChain).c_str(), nBestHeight, BlockHashStr(hashBestChain).c_str(), nBestHeight,
DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexBest->GetBlockTime()).c_str()); DateTimeStrFormat("%Y-%m-%d %H:%M:%S", pindexBest->GetBlockTime()).c_str());
@ -2743,7 +2741,7 @@ bool InitBlockIndex() {
CDiskBlockPos blockPos; CDiskBlockPos blockPos;
CValidationState state; CValidationState state;
if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime)) if (!FindBlockPos(state, blockPos, nBlockSize+8, 0, block.nTime))
return error("AcceptBlock() : FindBlockPos failed"); return error("LoadBlockIndex() : FindBlockPos failed");
if (!block.WriteToDisk(blockPos)) if (!block.WriteToDisk(blockPos))
return error("LoadBlockIndex() : writing genesis block to disk failed"); return error("LoadBlockIndex() : writing genesis block to disk failed");
if (!block.AddToBlockIndex(state, blockPos)) if (!block.AddToBlockIndex(state, blockPos))

View file

@ -28,7 +28,7 @@ struct CBlockIndexWorkComparator;
static const unsigned int MAX_BLOCK_SIZE = 1000000; static const unsigned int MAX_BLOCK_SIZE = 1000000;
/** The maximum size for mined blocks */ /** The maximum size for mined blocks */
static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/2; static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/2;
/** The maximum size for transactions we're willing to relay/mine **/ /** The maximum size for transactions we're willing to relay/mine */
static const unsigned int MAX_STANDARD_TX_SIZE = MAX_BLOCK_SIZE_GEN/5; static const unsigned int MAX_STANDARD_TX_SIZE = MAX_BLOCK_SIZE_GEN/5;
/** The maximum allowed number of signature check operations in a block (network rule) */ /** The maximum allowed number of signature check operations in a block (network rule) */
static const unsigned int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50; static const unsigned int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50;
@ -118,7 +118,6 @@ class CValidationState;
struct CBlockTemplate; struct CBlockTemplate;
/** Register a wallet to receive updates from core */ /** Register a wallet to receive updates from core */
void RegisterWallet(CWallet* pwalletIn); void RegisterWallet(CWallet* pwalletIn);
/** Unregister a wallet from core */ /** Unregister a wallet from core */
@ -1549,7 +1548,7 @@ public:
} }
std::string ToString() const { std::string ToString() const {
return strprintf("CBlockFileInfo(blocks=%u, size=%u, heights=%u..%u, time=%s..%s)", nBlocks, nSize, nHeightFirst, nHeightLast, DateTimeStrFormat("%Y-%m-%d", nTimeFirst).c_str(), DateTimeStrFormat("%Y-%m-%d", nTimeLast).c_str()); return strprintf("CBlockFileInfo(blocks=%u, size=%u, heights=%u...%u, time=%s...%s)", nBlocks, nSize, nHeightFirst, nHeightLast, DateTimeStrFormat("%Y-%m-%d", nTimeFirst).c_str(), DateTimeStrFormat("%Y-%m-%d", nTimeLast).c_str());
} }
// update statistics (does not update nSize) // update statistics (does not update nSize)