diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/src/main.cpp b/src/main.cpp index 145ff7857e..2a133b3eae 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,20 +3,26 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include <boost/algorithm/string/replace.hpp> -#include <boost/filesystem.hpp> -#include <boost/filesystem/fstream.hpp> +#include "main.h" +#include "addrman.h" #include "alert.h" #include "chainparams.h" #include "checkpoints.h" #include "checkqueue.h" -#include "db.h" #include "init.h" #include "net.h" #include "txdb.h" #include "txmempool.h" #include "ui_interface.h" +#include "util.h" + +#include <inttypes.h> +#include <stdint.h> + +#include <boost/algorithm/string/replace.hpp> +#include <boost/filesystem.hpp> +#include <boost/filesystem/fstream.hpp> using namespace std; using namespace boost; @@ -25,16 +31,13 @@ using namespace boost; // Global state // -CCriticalSection cs_setpwalletRegistered; -set<CWallet*> setpwalletRegistered; - CCriticalSection cs_main; CTxMemPool mempool; map<uint256, CBlockIndex*> mapBlockIndex; CChain chainActive; -int64 nTimeBestReceived = 0; +int64_t nTimeBestReceived = 0; int nScriptCheckThreads = 0; bool fImporting = false; bool fReindex = false; @@ -43,9 +46,9 @@ bool fTxIndex = false; unsigned int nCoinCacheSize = 5000; /** Fees smaller than this (in satoshi) are considered zero fee (for transaction creation) */ -int64 CTransaction::nMinTxFee = 10000; // Override with -mintxfee +int64_t CTransaction::nMinTxFee = 10000; // Override with -mintxfee /** Fees smaller than this (in satoshi) are considered zero fee (for relaying) */ -int64 CTransaction::nMinRelayTxFee = 10000; +int64_t CTransaction::nMinRelayTxFee = 10000; static CMedianFilter<int> cPeerBlockCounts(8, 0); // Amount of blocks that other nodes claim to have @@ -61,7 +64,7 @@ CScript COINBASE_FLAGS; const string strMessageMagic = "Bitcoin Signed Message:\n"; // Settings -int64 nTransactionFee = 0; +int64_t nTransactionFee = 0; // Internal stuff namespace { @@ -481,7 +484,7 @@ bool IsStandardTx(const CTransaction& tx, string& reason) return true; } -bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64 nBlockTime) +bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime) { // Time based nLockTime implemented in 0.1.6 if (tx.nLockTime == 0) @@ -490,7 +493,7 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64 nBlockTime) nBlockHeight = chainActive.Height(); if (nBlockTime == 0) nBlockTime = GetAdjustedTime(); - if ((int64)tx.nLockTime < ((int64)tx.nLockTime < LOCKTIME_THRESHOLD ? (int64)nBlockHeight : nBlockTime)) + if ((int64_t)tx.nLockTime < ((int64_t)tx.nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime)) return true; BOOST_FOREACH(const CTxIn& txin, tx.vin) if (!txin.IsFinal()) @@ -501,9 +504,9 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64 nBlockTime) /** Amount of bitcoins spent by the transaction. @return sum of all outputs (note: does not include fees) */ -int64 GetValueOut(const CTransaction& tx) +int64_t GetValueOut(const CTransaction& tx) { - int64 nValueOut = 0; + int64_t nValueOut = 0; BOOST_FOREACH(const CTxOut& txout, tx.vout) { nValueOut += txout.nValue; @@ -672,7 +675,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state) return state.DoS(100, error("CTransaction::CheckTransaction() : size limits failed")); // Check for negative or overflow output values - int64 nValueOut = 0; + int64_t nValueOut = 0; BOOST_FOREACH(const CTxOut& txout, tx.vout) { if (txout.nValue < 0) @@ -708,13 +711,13 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state) return true; } -int64 GetMinFee(const CTransaction& tx, bool fAllowFree, enum GetMinFee_mode mode) +int64_t GetMinFee(const CTransaction& tx, bool fAllowFree, enum GetMinFee_mode mode) { // Base fee is either nMinTxFee or nMinRelayTxFee - int64 nBaseFee = (mode == GMF_RELAY) ? tx.nMinRelayTxFee : tx.nMinTxFee; + int64_t nBaseFee = (mode == GMF_RELAY) ? tx.nMinRelayTxFee : tx.nMinTxFee; unsigned int nBytes = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); - int64 nMinFee = (1 + (int64)nBytes / 1000) * nBaseFee; + int64_t nMinFee = (1 + (int64_t)nBytes / 1000) * nBaseFee; if (fAllowFree) { @@ -842,13 +845,13 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa // you should add code here to check that the transaction does a // reasonable number of ECDSA signature verifications. - int64 nFees = view.GetValueIn(tx)-GetValueOut(tx); + int64_t nFees = view.GetValueIn(tx)-GetValueOut(tx); unsigned int nSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION); // Don't accept it if it can't get into a block - int64 txMinFee = GetMinFee(tx, true, GMF_RELAY); + int64_t txMinFee = GetMinFee(tx, true, GMF_RELAY); if (fLimitFree && nFees < txMinFee) - return error("AcceptToMemoryPool: : not enough fees %s, %"PRI64d" < %"PRI64d, + return error("AcceptToMemoryPool: : not enough fees %s, %"PRId64" < %"PRId64, hash.ToString().c_str(), nFees, txMinFee); @@ -859,8 +862,8 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa { static CCriticalSection csFreeLimiter; static double dFreeCount; - static int64 nLastTime; - int64 nNow = GetTime(); + static int64_t nLastTime; + int64_t nNow = GetTime(); LOCK(csFreeLimiter); @@ -876,7 +879,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa } if (fRejectInsaneFee && nFees > CTransaction::nMinRelayTxFee * 10000) - return error("AcceptToMemoryPool: : insane fees %s, %"PRI64d" > %"PRI64d, + return error("AcceptToMemoryPool: : insane fees %s, %"PRId64" > %"PRId64, hash.ToString().c_str(), nFees, CTransaction::nMinRelayTxFee * 10000); @@ -1090,9 +1093,9 @@ uint256 static GetOrphanRoot(const CBlockHeader* pblock) return pblock->GetHash(); } -int64 GetBlockValue(int nHeight, int64 nFees) +int64_t GetBlockValue(int nHeight, int64_t nFees) { - int64 nSubsidy = 50 * COIN; + int64_t nSubsidy = 50 * COIN; // Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years. nSubsidy >>= (nHeight / Params().SubsidyHalvingInterval()); @@ -1100,15 +1103,15 @@ int64 GetBlockValue(int nHeight, int64 nFees) return nSubsidy + nFees; } -static const int64 nTargetTimespan = 14 * 24 * 60 * 60; // two weeks -static const int64 nTargetSpacing = 10 * 60; -static const int64 nInterval = nTargetTimespan / nTargetSpacing; +static const int64_t nTargetTimespan = 14 * 24 * 60 * 60; // two weeks +static const int64_t nTargetSpacing = 10 * 60; +static const int64_t nInterval = nTargetTimespan / nTargetSpacing; // // minimum amount of work that could possibly be required nTime after // minimum work required was nBase // -unsigned int ComputeMinWork(unsigned int nBase, int64 nTime) +unsigned int ComputeMinWork(unsigned int nBase, int64_t nTime) { const CBigNum &bnLimit = Params().ProofOfWorkLimit(); // Testnet has min-difficulty blocks @@ -1167,8 +1170,8 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead assert(pindexFirst); // Limit adjustment step - int64 nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime(); - LogPrintf(" nActualTimespan = %"PRI64d" before bounds\n", nActualTimespan); + int64_t nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime(); + LogPrintf(" nActualTimespan = %"PRId64" before bounds\n", nActualTimespan); if (nActualTimespan < nTargetTimespan/4) nActualTimespan = nTargetTimespan/4; if (nActualTimespan > nTargetTimespan*4) @@ -1185,7 +1188,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead /// debug print LogPrintf("GetNextWorkRequired RETARGET\n"); - LogPrintf("nTargetTimespan = %"PRI64d" nActualTimespan = %"PRI64d"\n", nTargetTimespan, nActualTimespan); + LogPrintf("nTargetTimespan = %"PRId64" nActualTimespan = %"PRId64"\n", nTargetTimespan, nActualTimespan); LogPrintf("Before: %08x %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str()); LogPrintf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str()); @@ -1218,7 +1221,7 @@ bool IsInitialBlockDownload() { if (fImporting || fReindex || chainActive.Height() < Checkpoints::GetTotalBlocksEstimate()) return true; - static int64 nLastUpdate; + static int64_t nLastUpdate; static CBlockIndex* pindexLastBest; if (chainActive.Tip() != pindexLastBest) { @@ -1420,12 +1423,12 @@ const CTxOut &CCoinsViewCache::GetOutputFor(const CTxIn& input) return coins.vout[input.prevout.n]; } -int64 CCoinsViewCache::GetValueIn(const CTransaction& tx) +int64_t CCoinsViewCache::GetValueIn(const CTransaction& tx) { if (tx.IsCoinBase()) return 0; - int64 nResult = 0; + int64_t nResult = 0; for (unsigned int i = 0; i < tx.vin.size(); i++) nResult += GetOutputFor(tx.vin[i]).nValue; @@ -1496,8 +1499,8 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, CCoinsViewCach // While checking, GetBestBlock() refers to the parent block. // This is also true for mempool checks. int nSpendHeight = inputs.GetBestBlock()->nHeight + 1; - int64 nValueIn = 0; - int64 nFees = 0; + int64_t nValueIn = 0; + int64_t nFees = 0; for (unsigned int i = 0; i < tx.vin.size(); i++) { const COutPoint &prevout = tx.vin[i].prevout; @@ -1520,7 +1523,7 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, CCoinsViewCach return state.DoS(100, error("CheckInputs() : %s value in < value out", tx.GetHash().ToString().c_str())); // Tally transaction fees - int64 nTxFee = nValueIn - GetValueOut(tx); + int64_t nTxFee = nValueIn - GetValueOut(tx); if (nTxFee < 0) return state.DoS(100, error("CheckInputs() : %s nTxFee < 0", tx.GetHash().ToString().c_str())); nFees += nTxFee; @@ -1725,7 +1728,7 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C } // BIP16 didn't become active until Apr 1 2012 - int64 nBIP16SwitchTime = 1333238400; + int64_t nBIP16SwitchTime = 1333238400; bool fStrictPayToScriptHash = (pindex->nTime >= nBIP16SwitchTime); unsigned int flags = SCRIPT_VERIFY_NOCACHE | @@ -1735,8 +1738,8 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C CCheckQueueControl<CScriptCheck> control(fScriptChecks && nScriptCheckThreads ? &scriptcheckqueue : NULL); - int64 nStart = GetTimeMicros(); - int64 nFees = 0; + int64_t nStart = GetTimeMicros(); + int64_t nFees = 0; int nInputs = 0; unsigned int nSigOps = 0; CDiskTxPos pos(pindex->GetBlockPos(), GetSizeOfCompactSize(block.vtx.size())); @@ -1782,16 +1785,16 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C vPos.push_back(std::make_pair(block.GetTxHash(i), pos)); pos.nTxOffset += ::GetSerializeSize(tx, SER_DISK, CLIENT_VERSION); } - int64 nTime = GetTimeMicros() - nStart; + int64_t nTime = GetTimeMicros() - nStart; if (fBenchmark) LogPrintf("- Connect %u transactions: %.2fms (%.3fms/tx, %.3fms/txin)\n", (unsigned)block.vtx.size(), 0.001 * nTime, 0.001 * nTime / block.vtx.size(), nInputs <= 1 ? 0 : 0.001 * nTime / (nInputs-1)); if (GetValueOut(block.vtx[0]) > GetBlockValue(pindex->nHeight, nFees)) - return state.DoS(100, error("ConnectBlock() : coinbase pays too much (actual=%"PRI64d" vs limit=%"PRI64d")", GetValueOut(block.vtx[0]), GetBlockValue(pindex->nHeight, nFees))); + return state.DoS(100, error("ConnectBlock() : coinbase pays too much (actual=%"PRId64" vs limit=%"PRId64")", GetValueOut(block.vtx[0]), GetBlockValue(pindex->nHeight, nFees))); if (!control.Wait()) return state.DoS(100, false); - int64 nTime2 = GetTimeMicros() - nStart; + int64_t nTime2 = GetTimeMicros() - nStart; if (fBenchmark) LogPrintf("- Verify %u txins: %.2fms (%.3fms/txin)\n", nInputs - 1, 0.001 * nTime2, nInputs <= 1 ? 0 : 0.001 * nTime2 / (nInputs-1)); @@ -1879,7 +1882,7 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew) CBlock block; if (!ReadBlockFromDisk(block, pindex)) return state.Abort(_("Failed to read block")); - int64 nStart = GetTimeMicros(); + int64_t nStart = GetTimeMicros(); if (!DisconnectBlock(block, state, pindex, view)) return error("SetBestBlock() : DisconnectBlock %s failed", pindex->GetBlockHash().ToString().c_str()); if (fBenchmark) @@ -1899,7 +1902,7 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew) CBlock block; if (!ReadBlockFromDisk(block, pindex)) return state.Abort(_("Failed to read block")); - int64 nStart = GetTimeMicros(); + int64_t nStart = GetTimeMicros(); if (!ConnectBlock(block, state, pindex, view)) { if (state.IsInvalid()) { InvalidChainFound(pindexNew); @@ -1916,10 +1919,10 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew) } // Flush changes to global coin state - int64 nStart = GetTimeMicros(); + int64_t nStart = GetTimeMicros(); int nModified = view.GetCacheSize(); assert(view.Flush()); - int64 nTime = GetTimeMicros() - nStart; + int64_t nTime = GetTimeMicros() - nStart; if (fBenchmark) LogPrintf("- Flush %i transactions: %.2fms (%.4fms/tx)\n", nModified, 0.001 * nTime, 0.001 * nTime / nModified); @@ -2056,7 +2059,7 @@ bool AddToBlockIndex(CBlock& block, CValidationState& state, const CDiskBlockPos } -bool FindBlockPos(CValidationState &state, CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeight, uint64 nTime, bool fKnown = false) +bool FindBlockPos(CValidationState &state, CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeight, uint64_t nTime, bool fKnown = false) { bool fUpdatedLast = false; @@ -2309,7 +2312,7 @@ bool CBlockIndex::IsSuperMajority(int minVersion, const CBlockIndex* pstart, uns return (nFound >= nRequired); } -int64 CBlockIndex::GetMedianTime() const +int64_t CBlockIndex::GetMedianTime() const { const CBlockIndex* pindex = this; for (int i = 0; i < nMedianTimeSpan/2; i++) @@ -2349,7 +2352,7 @@ bool ProcessBlock(CValidationState &state, CNode* pfrom, CBlock* pblock, CDiskBl if (pcheckpoint && pblock->hashPrevBlock != (chainActive.Tip() ? chainActive.Tip()->GetBlockHash() : uint256(0))) { // Extra checks to prevent "fill up memory by spamming with bogus blocks" - int64 deltaTime = pblock->GetBlockTime() - pcheckpoint->nTime; + int64_t deltaTime = pblock->GetBlockTime() - pcheckpoint->nTime; if (deltaTime < 0) { return state.DoS(100, error("ProcessBlock() : block with timestamp before last checkpoint")); @@ -2579,9 +2582,9 @@ bool AbortNode(const std::string &strMessage) { return false; } -bool CheckDiskSpace(uint64 nAdditionalBytes) +bool CheckDiskSpace(uint64_t nAdditionalBytes) { - uint64 nFreeBytesAvailable = filesystem::space(GetDataDir()).available; + uint64_t nFreeBytesAvailable = filesystem::space(GetDataDir()).available; // Check for nMinDiskSpace bytes (currently 50MB) if (nFreeBytesAvailable < nMinDiskSpace + nAdditionalBytes) @@ -2888,12 +2891,12 @@ void PrintBlockTree() bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) { - int64 nStart = GetTimeMillis(); + int64_t nStart = GetTimeMillis(); int nLoaded = 0; try { CBufferedFile blkdat(fileIn, 2*MAX_BLOCK_SIZE, MAX_BLOCK_SIZE+8, SER_DISK, CLIENT_VERSION); - uint64 nStartByte = 0; + uint64_t nStartByte = 0; if (dbp) { // (try to) skip already indexed part CBlockFileInfo info; @@ -2902,7 +2905,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) blkdat.Seek(info.nSize); } } - uint64 nRewind = blkdat.GetPos(); + uint64_t nRewind = blkdat.GetPos(); while (blkdat.good() && !blkdat.eof()) { boost::this_thread::interruption_point(); @@ -2928,7 +2931,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) } try { // read block - uint64 nBlockPos = blkdat.GetPos(); + uint64_t nBlockPos = blkdat.GetPos(); blkdat.SetLimit(nBlockPos + nSize); CBlock block; blkdat >> block; @@ -2954,7 +2957,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) AbortNode(_("Error: system error: ") + e.what()); } if (nLoaded > 0) - LogPrintf("Loaded %i blocks from external file in %"PRI64d"ms\n", nLoaded, GetTimeMillis() - nStart); + LogPrintf("Loaded %i blocks from external file in %"PRId64"ms\n", nLoaded, GetTimeMillis() - nStart); return nLoaded > 0; } @@ -2972,9 +2975,6 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp) // CAlert // -extern map<uint256, CAlert> mapAlerts; -extern CCriticalSection cs_mapAlerts; - string GetWarnings(string strFor) { int nPriority = 0; @@ -3197,10 +3197,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) return false; } - int64 nTime; + int64_t nTime; CAddress addrMe; CAddress addrFrom; - uint64 nNonce = 1; + uint64_t nNonce = 1; vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe; if (pfrom->nVersion < MIN_PEER_PROTO_VERSION) { @@ -3321,8 +3321,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) // Store the new addresses vector<CAddress> vAddrOk; - int64 nNow = GetAdjustedTime(); - int64 nSince = nNow - 10 * 60; + int64_t nNow = GetAdjustedTime(); + int64_t nSince = nNow - 10 * 60; BOOST_FOREACH(CAddress& addr, vAddr) { boost::this_thread::interruption_point(); @@ -3341,7 +3341,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) static uint256 hashSalt; if (hashSalt == 0) hashSalt = GetRandHash(); - uint64 hashAddr = addr.GetHash(); + uint64_t hashAddr = addr.GetHash(); uint256 hashRand = hashSalt ^ (hashAddr<<32) ^ ((GetTime()+hashAddr)/(24*60*60)); hashRand = Hash(BEGIN(hashRand), END(hashRand)); multimap<uint256, CNode*> mapMix; @@ -3655,7 +3655,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) { if (pfrom->nVersion > BIP0031_VERSION) { - uint64 nonce = 0; + uint64_t nonce = 0; vRecv >> nonce; // Echo the message back with the nonce. This allows for two useful features: // @@ -3675,8 +3675,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) else if (strCommand == "pong") { - int64 pingUsecEnd = GetTimeMicros(); - uint64 nonce = 0; + int64_t pingUsecEnd = GetTimeMicros(); + uint64_t nonce = 0; size_t nAvail = vRecv.in_avail(); bool bPingFinished = false; std::string sProblem; @@ -3689,7 +3689,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (nonce == pfrom->nPingNonceSent) { // Matching pong received, this ping is no longer outstanding bPingFinished = true; - int64 pingUsecTime = pingUsecEnd - pfrom->nPingUsecStart; + int64_t pingUsecTime = pingUsecEnd - pfrom->nPingUsecStart; if (pingUsecTime > 0) { // Successful ping time measurement, replace previous pfrom->nPingUsecTime = pingUsecTime; @@ -3716,7 +3716,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) } if (!(sProblem.empty())) { - LogPrint("net", "pong %s %s: %s, %"PRI64x" expected, %"PRI64x" received, %"PRIszu" bytes\n", + LogPrint("net", "pong %s %s: %s, %"PRIx64" expected, %"PRIx64" received, %"PRIszu" bytes\n", pfrom->addr.ToString().c_str(), pfrom->strSubVer.c_str(), sProblem.c_str(), @@ -3965,7 +3965,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) pingSend = true; } if (pingSend) { - uint64 nonce = 0; + uint64_t nonce = 0; while (nonce == 0) { RAND_bytes((unsigned char*)&nonce, sizeof(nonce)); } @@ -3983,7 +3983,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) } // Address refresh broadcast - static int64 nLastRebroadcast; + static int64_t nLastRebroadcast; if (!IsInitialBlockDownload() && (GetTime() - nLastRebroadcast > 24 * 60 * 60)) { { @@ -4103,7 +4103,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) // Message: getdata // vector<CInv> vGetData; - int64 nNow = GetTime() * 1000000; + int64_t nNow = GetTime() * 1000000; while (!pto->mapAskFor.empty() && (*pto->mapAskFor.begin()).first <= nNow) { const CInv& inv = (*pto->mapAskFor.begin()).second; |