Merge #9644: [refactor] Remove using namespace <xxx> from src/
b7b48c8 Refactor: Remove using namespace <xxx> from src/*.cpp. (Karl-Johan Alm)
This commit is contained in:
parent
daa8582b18
commit
25074aeb43
@ -19,15 +19,13 @@
|
||||
#define LN2SQUARED 0.4804530139182014246671025263266649717305529515945455
|
||||
#define LN2 0.6931471805599453094172321214581765680755001343602552
|
||||
|
||||
using namespace std;
|
||||
|
||||
CBloomFilter::CBloomFilter(unsigned int nElements, double nFPRate, unsigned int nTweakIn, unsigned char nFlagsIn) :
|
||||
/**
|
||||
* The ideal size for a bloom filter with a given number of elements and false positive rate is:
|
||||
* - nElements * log(fp rate) / ln(2)^2
|
||||
* We ignore filter parameters which will create a bloom filter larger than the protocol limits
|
||||
*/
|
||||
vData(min((unsigned int)(-1 / LN2SQUARED * nElements * log(nFPRate)), MAX_BLOOM_FILTER_SIZE * 8) / 8),
|
||||
vData(std::min((unsigned int)(-1 / LN2SQUARED * nElements * log(nFPRate)), MAX_BLOOM_FILTER_SIZE * 8) / 8),
|
||||
/**
|
||||
* The ideal number of hash functions is filter size * ln(2) / number of elements
|
||||
* Again, we ignore filter parameters which will create a bloom filter with more hash functions than the protocol limits
|
||||
@ -35,7 +33,7 @@ CBloomFilter::CBloomFilter(unsigned int nElements, double nFPRate, unsigned int
|
||||
*/
|
||||
isFull(false),
|
||||
isEmpty(true),
|
||||
nHashFuncs(min((unsigned int)(vData.size() * 8 / nElements * LN2), MAX_HASH_FUNCS)),
|
||||
nHashFuncs(std::min((unsigned int)(vData.size() * 8 / nElements * LN2), MAX_HASH_FUNCS)),
|
||||
nTweak(nTweakIn),
|
||||
nFlags(nFlagsIn)
|
||||
{
|
||||
@ -58,7 +56,7 @@ inline unsigned int CBloomFilter::Hash(unsigned int nHashNum, const std::vector<
|
||||
return MurmurHash3(nHashNum * 0xFBA4C795 + nTweak, vDataToHash) % (vData.size() * 8);
|
||||
}
|
||||
|
||||
void CBloomFilter::insert(const vector<unsigned char>& vKey)
|
||||
void CBloomFilter::insert(const std::vector<unsigned char>& vKey)
|
||||
{
|
||||
if (isFull)
|
||||
return;
|
||||
@ -75,17 +73,17 @@ void CBloomFilter::insert(const COutPoint& outpoint)
|
||||
{
|
||||
CDataStream stream(SER_NETWORK, PROTOCOL_VERSION);
|
||||
stream << outpoint;
|
||||
vector<unsigned char> data(stream.begin(), stream.end());
|
||||
std::vector<unsigned char> data(stream.begin(), stream.end());
|
||||
insert(data);
|
||||
}
|
||||
|
||||
void CBloomFilter::insert(const uint256& hash)
|
||||
{
|
||||
vector<unsigned char> data(hash.begin(), hash.end());
|
||||
std::vector<unsigned char> data(hash.begin(), hash.end());
|
||||
insert(data);
|
||||
}
|
||||
|
||||
bool CBloomFilter::contains(const vector<unsigned char>& vKey) const
|
||||
bool CBloomFilter::contains(const std::vector<unsigned char>& vKey) const
|
||||
{
|
||||
if (isFull)
|
||||
return true;
|
||||
@ -105,13 +103,13 @@ bool CBloomFilter::contains(const COutPoint& outpoint) const
|
||||
{
|
||||
CDataStream stream(SER_NETWORK, PROTOCOL_VERSION);
|
||||
stream << outpoint;
|
||||
vector<unsigned char> data(stream.begin(), stream.end());
|
||||
std::vector<unsigned char> data(stream.begin(), stream.end());
|
||||
return contains(data);
|
||||
}
|
||||
|
||||
bool CBloomFilter::contains(const uint256& hash) const
|
||||
{
|
||||
vector<unsigned char> data(hash.begin(), hash.end());
|
||||
std::vector<unsigned char> data(hash.begin(), hash.end());
|
||||
return contains(data);
|
||||
}
|
||||
|
||||
@ -154,7 +152,7 @@ bool CBloomFilter::IsRelevantAndUpdate(const CTransaction& tx)
|
||||
// This means clients don't have to update the filter themselves when a new relevant tx
|
||||
// is discovered in order to find spending transactions, which avoids round-tripping and race conditions.
|
||||
CScript::const_iterator pc = txout.scriptPubKey.begin();
|
||||
vector<unsigned char> data;
|
||||
std::vector<unsigned char> data;
|
||||
while (pc < txout.scriptPubKey.end())
|
||||
{
|
||||
opcodetype opcode;
|
||||
@ -168,7 +166,7 @@ bool CBloomFilter::IsRelevantAndUpdate(const CTransaction& tx)
|
||||
else if ((nFlags & BLOOM_UPDATE_MASK) == BLOOM_UPDATE_P2PUBKEY_ONLY)
|
||||
{
|
||||
txnouttype type;
|
||||
vector<vector<unsigned char> > vSolutions;
|
||||
std::vector<std::vector<unsigned char> > vSolutions;
|
||||
if (Solver(txout.scriptPubKey, type, vSolutions) &&
|
||||
(type == TX_PUBKEY || type == TX_MULTISIG))
|
||||
insert(COutPoint(hash, i));
|
||||
@ -189,7 +187,7 @@ bool CBloomFilter::IsRelevantAndUpdate(const CTransaction& tx)
|
||||
|
||||
// Match if the filter contains any arbitrary script data element in any scriptSig in tx
|
||||
CScript::const_iterator pc = txin.scriptSig.begin();
|
||||
vector<unsigned char> data;
|
||||
std::vector<unsigned char> data;
|
||||
while (pc < txin.scriptSig.end())
|
||||
{
|
||||
opcodetype opcode;
|
||||
@ -280,7 +278,7 @@ void CRollingBloomFilter::insert(const std::vector<unsigned char>& vKey)
|
||||
|
||||
void CRollingBloomFilter::insert(const uint256& hash)
|
||||
{
|
||||
vector<unsigned char> vData(hash.begin(), hash.end());
|
||||
std::vector<unsigned char> vData(hash.begin(), hash.end());
|
||||
insert(vData);
|
||||
}
|
||||
|
||||
@ -300,7 +298,7 @@ bool CRollingBloomFilter::contains(const std::vector<unsigned char>& vKey) const
|
||||
|
||||
bool CRollingBloomFilter::contains(const uint256& hash) const
|
||||
{
|
||||
vector<unsigned char> vData(hash.begin(), hash.end());
|
||||
std::vector<unsigned char> vData(hash.begin(), hash.end());
|
||||
return contains(vData);
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,6 @@
|
||||
|
||||
#include "chain.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* CChain implementation
|
||||
*/
|
||||
|
@ -20,13 +20,11 @@
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/assign/list_of.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
CScript ParseScript(const std::string& s)
|
||||
{
|
||||
CScript result;
|
||||
|
||||
static map<string, opcodetype> mapOpNames;
|
||||
static std::map<std::string, opcodetype> mapOpNames;
|
||||
|
||||
if (mapOpNames.empty())
|
||||
{
|
||||
@ -39,7 +37,7 @@ CScript ParseScript(const std::string& s)
|
||||
const char* name = GetOpName((opcodetype)op);
|
||||
if (strcmp(name, "OP_UNKNOWN") == 0)
|
||||
continue;
|
||||
string strName(name);
|
||||
std::string strName(name);
|
||||
mapOpNames[strName] = (opcodetype)op;
|
||||
// Convenience: OP_ADD and just ADD are both recognized:
|
||||
boost::algorithm::replace_first(strName, "OP_", "");
|
||||
@ -47,7 +45,7 @@ CScript ParseScript(const std::string& s)
|
||||
}
|
||||
}
|
||||
|
||||
vector<string> words;
|
||||
std::vector<std::string> words;
|
||||
boost::algorithm::split(words, s, boost::algorithm::is_any_of(" \t\n"), boost::algorithm::token_compress_on);
|
||||
|
||||
for (std::vector<std::string>::const_iterator w = words.begin(); w != words.end(); ++w)
|
||||
@ -57,16 +55,16 @@ CScript ParseScript(const std::string& s)
|
||||
// Empty string, ignore. (boost::split given '' will return one word)
|
||||
}
|
||||
else if (all(*w, boost::algorithm::is_digit()) ||
|
||||
(boost::algorithm::starts_with(*w, "-") && all(string(w->begin()+1, w->end()), boost::algorithm::is_digit())))
|
||||
(boost::algorithm::starts_with(*w, "-") && all(std::string(w->begin()+1, w->end()), boost::algorithm::is_digit())))
|
||||
{
|
||||
// Number
|
||||
int64_t n = atoi64(*w);
|
||||
result << n;
|
||||
}
|
||||
else if (boost::algorithm::starts_with(*w, "0x") && (w->begin()+2 != w->end()) && IsHex(string(w->begin()+2, w->end())))
|
||||
else if (boost::algorithm::starts_with(*w, "0x") && (w->begin()+2 != w->end()) && IsHex(std::string(w->begin()+2, w->end())))
|
||||
{
|
||||
// Raw hex data, inserted NOT pushed onto stack:
|
||||
std::vector<unsigned char> raw = ParseHex(string(w->begin()+2, w->end()));
|
||||
std::vector<unsigned char> raw = ParseHex(std::string(w->begin()+2, w->end()));
|
||||
result.insert(result.end(), raw.begin(), raw.end());
|
||||
}
|
||||
else if (w->size() >= 2 && boost::algorithm::starts_with(*w, "'") && boost::algorithm::ends_with(*w, "'"))
|
||||
@ -83,7 +81,7 @@ CScript ParseScript(const std::string& s)
|
||||
}
|
||||
else
|
||||
{
|
||||
throw runtime_error("script parse error");
|
||||
throw std::runtime_error("script parse error");
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +93,7 @@ bool DecodeHexTx(CMutableTransaction& tx, const std::string& strHexTx)
|
||||
if (!IsHex(strHexTx))
|
||||
return false;
|
||||
|
||||
vector<unsigned char> txData(ParseHex(strHexTx));
|
||||
std::vector<unsigned char> txData(ParseHex(strHexTx));
|
||||
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
|
||||
try {
|
||||
ssData >> tx;
|
||||
@ -124,9 +122,9 @@ bool DecodeHexBlk(CBlock& block, const std::string& strHexBlk)
|
||||
return true;
|
||||
}
|
||||
|
||||
uint256 ParseHashUV(const UniValue& v, const string& strName)
|
||||
uint256 ParseHashUV(const UniValue& v, const std::string& strName)
|
||||
{
|
||||
string strHex;
|
||||
std::string strHex;
|
||||
if (v.isStr())
|
||||
strHex = v.getValStr();
|
||||
return ParseHashStr(strHex, strName); // Note: ParseHashStr("") throws a runtime_error
|
||||
@ -135,19 +133,19 @@ uint256 ParseHashUV(const UniValue& v, const string& strName)
|
||||
uint256 ParseHashStr(const std::string& strHex, const std::string& strName)
|
||||
{
|
||||
if (!IsHex(strHex)) // Note: IsHex("") is false
|
||||
throw runtime_error(strName+" must be hexadecimal string (not '"+strHex+"')");
|
||||
throw std::runtime_error(strName + " must be hexadecimal string (not '" + strHex + "')");
|
||||
|
||||
uint256 result;
|
||||
result.SetHex(strHex);
|
||||
return result;
|
||||
}
|
||||
|
||||
vector<unsigned char> ParseHexUV(const UniValue& v, const string& strName)
|
||||
std::vector<unsigned char> ParseHexUV(const UniValue& v, const std::string& strName)
|
||||
{
|
||||
string strHex;
|
||||
std::string strHex;
|
||||
if (v.isStr())
|
||||
strHex = v.getValStr();
|
||||
if (!IsHex(strHex))
|
||||
throw runtime_error(strName+" must be hexadecimal string (not '"+strHex+"')");
|
||||
throw std::runtime_error(strName + " must be hexadecimal string (not '" + strHex + "')");
|
||||
return ParseHex(strHex);
|
||||
}
|
||||
|
@ -18,16 +18,14 @@
|
||||
#include <boost/assign/list_of.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
string FormatScript(const CScript& script)
|
||||
std::string FormatScript(const CScript& script)
|
||||
{
|
||||
string ret;
|
||||
std::string ret;
|
||||
CScript::const_iterator it = script.begin();
|
||||
opcodetype op;
|
||||
while (it != script.end()) {
|
||||
CScript::const_iterator it2 = it;
|
||||
vector<unsigned char> vch;
|
||||
std::vector<unsigned char> vch;
|
||||
if (script.GetOp2(it, op, &vch)) {
|
||||
if (op == OP_0) {
|
||||
ret += "0 ";
|
||||
@ -36,9 +34,9 @@ string FormatScript(const CScript& script)
|
||||
ret += strprintf("%i ", op - OP_1NEGATE - 1);
|
||||
continue;
|
||||
} else if (op >= OP_NOP && op <= OP_NOP10) {
|
||||
string str(GetOpName(op));
|
||||
if (str.substr(0, 3) == string("OP_")) {
|
||||
ret += str.substr(3, string::npos) + " ";
|
||||
std::string str(GetOpName(op));
|
||||
if (str.substr(0, 3) == std::string("OP_")) {
|
||||
ret += str.substr(3, std::string::npos) + " ";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -55,14 +53,14 @@ string FormatScript(const CScript& script)
|
||||
return ret.substr(0, ret.size() - 1);
|
||||
}
|
||||
|
||||
const map<unsigned char, string> mapSigHashTypes =
|
||||
const std::map<unsigned char, std::string> mapSigHashTypes =
|
||||
boost::assign::map_list_of
|
||||
(static_cast<unsigned char>(SIGHASH_ALL), string("ALL"))
|
||||
(static_cast<unsigned char>(SIGHASH_ALL|SIGHASH_ANYONECANPAY), string("ALL|ANYONECANPAY"))
|
||||
(static_cast<unsigned char>(SIGHASH_NONE), string("NONE"))
|
||||
(static_cast<unsigned char>(SIGHASH_NONE|SIGHASH_ANYONECANPAY), string("NONE|ANYONECANPAY"))
|
||||
(static_cast<unsigned char>(SIGHASH_SINGLE), string("SINGLE"))
|
||||
(static_cast<unsigned char>(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY), string("SINGLE|ANYONECANPAY"))
|
||||
(static_cast<unsigned char>(SIGHASH_ALL), std::string("ALL"))
|
||||
(static_cast<unsigned char>(SIGHASH_ALL|SIGHASH_ANYONECANPAY), std::string("ALL|ANYONECANPAY"))
|
||||
(static_cast<unsigned char>(SIGHASH_NONE), std::string("NONE"))
|
||||
(static_cast<unsigned char>(SIGHASH_NONE|SIGHASH_ANYONECANPAY), std::string("NONE|ANYONECANPAY"))
|
||||
(static_cast<unsigned char>(SIGHASH_SINGLE), std::string("SINGLE"))
|
||||
(static_cast<unsigned char>(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY), std::string("SINGLE|ANYONECANPAY"))
|
||||
;
|
||||
|
||||
/**
|
||||
@ -72,11 +70,11 @@ const map<unsigned char, string> mapSigHashTypes =
|
||||
* of a signature. Only pass true for scripts you believe could contain signatures. For example,
|
||||
* pass false, or omit the this argument (defaults to false), for scriptPubKeys.
|
||||
*/
|
||||
string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDecode)
|
||||
std::string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDecode)
|
||||
{
|
||||
string str;
|
||||
std::string str;
|
||||
opcodetype opcode;
|
||||
vector<unsigned char> vch;
|
||||
std::vector<unsigned char> vch;
|
||||
CScript::const_iterator pc = script.begin();
|
||||
while (pc < script.end()) {
|
||||
if (!str.empty()) {
|
||||
@ -87,12 +85,12 @@ string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDecode)
|
||||
return str;
|
||||
}
|
||||
if (0 <= opcode && opcode <= OP_PUSHDATA4) {
|
||||
if (vch.size() <= static_cast<vector<unsigned char>::size_type>(4)) {
|
||||
if (vch.size() <= static_cast<std::vector<unsigned char>::size_type>(4)) {
|
||||
str += strprintf("%d", CScriptNum(vch, false).getint());
|
||||
} else {
|
||||
// the IsUnspendable check makes sure not to try to decode OP_RETURN data that may match the format of a signature
|
||||
if (fAttemptSighashDecode && !script.IsUnspendable()) {
|
||||
string strSigHashDecode;
|
||||
std::string strSigHashDecode;
|
||||
// goal: only attempt to decode a defined sighash type from data that looks like a signature within a scriptSig.
|
||||
// this won't decode correctly formatted public keys in Pubkey or Multisig scripts due to
|
||||
// the restrictions on the pubkey formats (see IsCompressedOrUncompressedPubKey) being incongruous with the
|
||||
@ -116,7 +114,7 @@ string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDecode)
|
||||
return str;
|
||||
}
|
||||
|
||||
string EncodeHexTx(const CTransaction& tx)
|
||||
std::string EncodeHexTx(const CTransaction& tx)
|
||||
{
|
||||
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
|
||||
ssTx << tx;
|
||||
@ -127,7 +125,7 @@ void ScriptPubKeyToUniv(const CScript& scriptPubKey,
|
||||
UniValue& out, bool fIncludeHex)
|
||||
{
|
||||
txnouttype type;
|
||||
vector<CTxDestination> addresses;
|
||||
std::vector<CTxDestination> addresses;
|
||||
int nRequired;
|
||||
|
||||
out.pushKV("asm", ScriptToAsmStr(scriptPubKey));
|
||||
|
29
src/init.cpp
29
src/init.cpp
@ -89,8 +89,6 @@
|
||||
#include "zmq/zmqnotificationinterface.h"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern void ThreadSendAlert(CConnman& connman);
|
||||
|
||||
bool fFeeEstimatesInitialized = false;
|
||||
@ -375,10 +373,10 @@ void OnRPCStopped()
|
||||
void OnRPCPreCommand(const CRPCCommand& cmd)
|
||||
{
|
||||
// Observe safe mode
|
||||
string strWarning = GetWarnings("rpc");
|
||||
std::string strWarning = GetWarnings("rpc");
|
||||
if (strWarning != "" && !GetBoolArg("-disablesafemode", DEFAULT_DISABLE_SAFEMODE) &&
|
||||
!cmd.okSafeMode)
|
||||
throw JSONRPCError(RPC_FORBIDDEN_BY_SAFE_MODE, string("Safe mode: ") + strWarning);
|
||||
throw JSONRPCError(RPC_FORBIDDEN_BY_SAFE_MODE, std::string("Safe mode: ") + strWarning);
|
||||
}
|
||||
|
||||
std::string HelpMessage(HelpMessageMode mode)
|
||||
@ -387,7 +385,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
|
||||
// When adding new options to the categories, please keep and ensure alphabetical ordering.
|
||||
// Do not translate _(...) -help-debug options, Many technical terms, and only a very small audience, so is unnecessary stress to translators.
|
||||
string strUsage = HelpMessageGroup(_("Options:"));
|
||||
std::string strUsage = HelpMessageGroup(_("Options:"));
|
||||
strUsage += HelpMessageOpt("-?", _("Print this help message and exit"));
|
||||
strUsage += HelpMessageOpt("-version", _("Print version and exit"));
|
||||
strUsage += HelpMessageOpt("-alerts", strprintf(_("Receive and display P2P network alerts (default: %u)"), DEFAULT_ALERTS));
|
||||
@ -508,8 +506,8 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-limitdescendantcount=<n>", strprintf("Do not accept transactions if any ancestor would have <n> or more in-mempool descendants (default: %u)", DEFAULT_DESCENDANT_LIMIT));
|
||||
strUsage += HelpMessageOpt("-limitdescendantsize=<n>", strprintf("Do not accept transactions if any ancestor would have more than <n> kilobytes of in-mempool descendants (default: %u).", DEFAULT_DESCENDANT_SIZE_LIMIT));
|
||||
}
|
||||
string debugCategories = "addrman, alert, bench, coindb, db, http, leveldb, libevent, lock, mempool, mempoolrej, net, proxy, prune, rand, reindex, rpc, selectcoins, tor, zmq, "
|
||||
"dash (or specifically: gobject, instantsend, keepass, masternode, mnpayments, mnsync, privatesend, spork)"; // Don't translate these and qt below
|
||||
std::string debugCategories = "addrman, alert, bench, coindb, db, http, leveldb, libevent, lock, mempool, mempoolrej, net, proxy, prune, rand, reindex, rpc, selectcoins, tor, zmq, "
|
||||
"dash (or specifically: gobject, instantsend, keepass, masternode, mnpayments, mnsync, privatesend, spork)"; // Don't translate these and qt below
|
||||
if (mode == HMM_BITCOIN_QT)
|
||||
debugCategories += ", qt";
|
||||
strUsage += HelpMessageOpt("-debug=<category>", strprintf(_("Output debugging information (default: %u, supplying <category> is optional)"), 0) + ". " +
|
||||
@ -671,15 +669,14 @@ struct CImportingNow
|
||||
// works correctly.
|
||||
void CleanupBlockRevFiles()
|
||||
{
|
||||
using namespace boost::filesystem;
|
||||
map<string, path> mapBlockFiles;
|
||||
std::map<std::string, boost::filesystem::path> mapBlockFiles;
|
||||
|
||||
// Glob all blk?????.dat and rev?????.dat files from the blocks directory.
|
||||
// Remove the rev files immediately and insert the blk file paths into an
|
||||
// ordered map keyed by block file index.
|
||||
LogPrintf("Removing unusable blk?????.dat and rev?????.dat files for -reindex with -prune\n");
|
||||
path blocksdir = GetDataDir() / "blocks";
|
||||
for (directory_iterator it(blocksdir); it != directory_iterator(); it++) {
|
||||
boost::filesystem::path blocksdir = GetDataDir() / "blocks";
|
||||
for (boost::filesystem::directory_iterator it(blocksdir); it != boost::filesystem::directory_iterator(); it++) {
|
||||
if (is_regular_file(*it) &&
|
||||
it->path().filename().string().length() == 12 &&
|
||||
it->path().filename().string().substr(8,4) == ".dat")
|
||||
@ -696,7 +693,7 @@ void CleanupBlockRevFiles()
|
||||
// keeping a separate counter. Once we hit a gap (or if 0 doesn't exist)
|
||||
// start removing block files.
|
||||
int nContigCounter = 0;
|
||||
BOOST_FOREACH(const PAIRTYPE(string, path)& item, mapBlockFiles) {
|
||||
BOOST_FOREACH(const PAIRTYPE(std::string, boost::filesystem::path)& item, mapBlockFiles) {
|
||||
if (atoi(item.first) == nContigCounter) {
|
||||
nContigCounter++;
|
||||
continue;
|
||||
@ -1047,8 +1044,8 @@ bool AppInitParameterInteraction()
|
||||
fDebug = mapMultiArgs.count("-debug");
|
||||
// Special-case: if -debug=0/-nodebug is set, turn off debugging messages
|
||||
if (fDebug) {
|
||||
const vector<string>& categories = mapMultiArgs.at("-debug");
|
||||
if (GetBoolArg("-nodebug", false) || find(categories.begin(), categories.end(), string("0")) != categories.end())
|
||||
const std::vector<std::string>& categories = mapMultiArgs.at("-debug");
|
||||
if (GetBoolArg("-nodebug", false) || find(categories.begin(), categories.end(), std::string("0")) != categories.end())
|
||||
fDebug = false;
|
||||
}
|
||||
|
||||
@ -1338,7 +1335,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
RegisterNodeSignals(GetNodeSignals());
|
||||
|
||||
// sanitize comments per BIP-0014, format user agent and check total size
|
||||
std::vector<string> uacomments;
|
||||
std::vector<std::string> uacomments;
|
||||
|
||||
if (chainparams.NetworkIDString() == CBaseChainParams::DEVNET) {
|
||||
// Add devnet name to user agent. This allows to disconnect nodes immediately if they don't belong to our own devnet
|
||||
@ -1346,7 +1343,7 @@ bool AppInitMain(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
}
|
||||
|
||||
if (mapMultiArgs.count("-uacomment")) {
|
||||
BOOST_FOREACH(string cmt, mapMultiArgs.at("-uacomment"))
|
||||
BOOST_FOREACH(std::string cmt, mapMultiArgs.at("-uacomment"))
|
||||
{
|
||||
if (cmt != SanitizeString(cmt, SAFE_CHARS_UA_COMMENT))
|
||||
return InitError(strprintf(_("User Agent comment (%s) contains unsafe characters."), cmt));
|
||||
|
@ -9,14 +9,12 @@
|
||||
#include "consensus/consensus.h"
|
||||
#include "utilstrencodings.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
CMerkleBlock::CMerkleBlock(const CBlock& block, CBloomFilter& filter)
|
||||
{
|
||||
header = block.GetBlockHeader();
|
||||
|
||||
vector<bool> vMatch;
|
||||
vector<uint256> vHashes;
|
||||
std::vector<bool> vMatch;
|
||||
std::vector<uint256> vHashes;
|
||||
|
||||
vMatch.reserve(block.vtx.size());
|
||||
vHashes.reserve(block.vtx.size());
|
||||
@ -27,7 +25,7 @@ CMerkleBlock::CMerkleBlock(const CBlock& block, CBloomFilter& filter)
|
||||
if (filter.IsRelevantAndUpdate(*block.vtx[i]))
|
||||
{
|
||||
vMatch.push_back(true);
|
||||
vMatchedTxn.push_back(make_pair(i, hash));
|
||||
vMatchedTxn.push_back(std::make_pair(i, hash));
|
||||
}
|
||||
else
|
||||
vMatch.push_back(false);
|
||||
@ -41,8 +39,8 @@ CMerkleBlock::CMerkleBlock(const CBlock& block, const std::set<uint256>& txids)
|
||||
{
|
||||
header = block.GetBlockHeader();
|
||||
|
||||
vector<bool> vMatch;
|
||||
vector<uint256> vHashes;
|
||||
std::vector<bool> vMatch;
|
||||
std::vector<uint256> vHashes;
|
||||
|
||||
vMatch.reserve(block.vtx.size());
|
||||
vHashes.reserve(block.vtx.size());
|
||||
|
@ -34,8 +34,6 @@
|
||||
#include <queue>
|
||||
#include <utility>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DashMiner
|
||||
@ -452,7 +450,7 @@ void BlockAssembler::addPackageTxs()
|
||||
}
|
||||
|
||||
// Package can be added. Sort the entries in a valid order.
|
||||
vector<CTxMemPool::txiter> sortedEntries;
|
||||
std::vector<CTxMemPool::txiter> sortedEntries;
|
||||
SortForBlock(ancestors, iter, sortedEntries);
|
||||
|
||||
for (size_t i=0; i<sortedEntries.size(); ++i) {
|
||||
@ -478,7 +476,7 @@ void BlockAssembler::addPriorityTxs()
|
||||
}
|
||||
|
||||
// This vector will be sorted into a priority queue:
|
||||
vector<TxCoinAgePriority> vecPriority;
|
||||
std::vector<TxCoinAgePriority> vecPriority;
|
||||
TxCoinAgePriorityCompare pricomparer;
|
||||
std::map<CTxMemPool::txiter, double, CTxMemPool::CompareIteratorByHash> waitPriMap;
|
||||
typedef std::map<CTxMemPool::txiter, double, CTxMemPool::CompareIteratorByHash>::iterator waitPriIter;
|
||||
|
@ -43,8 +43,6 @@
|
||||
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#if defined(NDEBUG)
|
||||
# error "Dash Core cannot be compiled without assertions."
|
||||
#endif
|
||||
@ -68,8 +66,8 @@ struct COrphanTx {
|
||||
NodeId fromPeer;
|
||||
int64_t nTimeExpire;
|
||||
};
|
||||
map<uint256, COrphanTx> mapOrphanTransactions GUARDED_BY(cs_main);
|
||||
map<COutPoint, set<map<uint256, COrphanTx>::iterator, IteratorComparator>> mapOrphanTransactionsByPrev GUARDED_BY(cs_main);
|
||||
std::map<uint256, COrphanTx> mapOrphanTransactions GUARDED_BY(cs_main);
|
||||
std::map<COutPoint, std::set<std::map<uint256, COrphanTx>::iterator, IteratorComparator>> mapOrphanTransactionsByPrev GUARDED_BY(cs_main);
|
||||
void EraseOrphansFor(NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
|
||||
static const uint64_t RANDOMIZER_ID_ADDRESS_RELAY = 0x3cac0035b5866b90ULL; // SHA256("main address relay")[0:8]
|
||||
@ -84,7 +82,7 @@ namespace {
|
||||
* messages or ban them when processing happens afterwards. Protected by
|
||||
* cs_main.
|
||||
*/
|
||||
map<uint256, NodeId> mapBlockSource;
|
||||
std::map<uint256, NodeId> mapBlockSource;
|
||||
|
||||
/**
|
||||
* Filter for transactions that were recently rejected by
|
||||
@ -115,7 +113,7 @@ namespace {
|
||||
CBlockIndex* pindex; //!< Optional.
|
||||
bool fValidatedHeaders; //!< Whether this block has validated headers at the time of request.
|
||||
};
|
||||
map<uint256, pair<NodeId, list<QueuedBlock>::iterator> > mapBlocksInFlight;
|
||||
std::map<uint256, std::pair<NodeId, std::list<QueuedBlock>::iterator> > mapBlocksInFlight;
|
||||
|
||||
/** Number of preferable block download peers. */
|
||||
int nPreferredDownload = 0;
|
||||
@ -139,7 +137,7 @@ namespace {
|
||||
|
||||
struct CBlockReject {
|
||||
unsigned char chRejectCode;
|
||||
string strRejectReason;
|
||||
std::string strRejectReason;
|
||||
uint256 hashBlock;
|
||||
};
|
||||
|
||||
@ -178,7 +176,7 @@ struct CNodeState {
|
||||
int64_t nHeadersSyncTimeout;
|
||||
//! Since when we're stalling block download progress (in microseconds), or 0.
|
||||
int64_t nStallingSince;
|
||||
list<QueuedBlock> vBlocksInFlight;
|
||||
std::list<QueuedBlock> vBlocksInFlight;
|
||||
//! When the first entry in vBlocksInFlight started downloading. Don't care when vBlocksInFlight is empty.
|
||||
int64_t nDownloadingSince;
|
||||
int nBlocksInFlight;
|
||||
@ -209,11 +207,11 @@ struct CNodeState {
|
||||
};
|
||||
|
||||
/** Map maintaining per-node state. Requires cs_main. */
|
||||
map<NodeId, CNodeState> mapNodeState;
|
||||
std::map<NodeId, CNodeState> mapNodeState;
|
||||
|
||||
// Requires cs_main.
|
||||
CNodeState *State(NodeId pnode) {
|
||||
map<NodeId, CNodeState>::iterator it = mapNodeState.find(pnode);
|
||||
std::map<NodeId, CNodeState>::iterator it = mapNodeState.find(pnode);
|
||||
if (it == mapNodeState.end())
|
||||
return NULL;
|
||||
return &it->second;
|
||||
@ -294,7 +292,7 @@ void FinalizeNode(NodeId nodeid, bool& fUpdateConnectionTime) {
|
||||
// Requires cs_main.
|
||||
// Returns a bool indicating whether we requested this block.
|
||||
bool MarkBlockAsReceived(const uint256& hash) {
|
||||
map<uint256, pair<NodeId, list<QueuedBlock>::iterator> >::iterator itInFlight = mapBlocksInFlight.find(hash);
|
||||
std::map<uint256, std::pair<NodeId, std::list<QueuedBlock>::iterator> >::iterator itInFlight = mapBlocksInFlight.find(hash);
|
||||
if (itInFlight != mapBlocksInFlight.end()) {
|
||||
CNodeState *state = State(itInFlight->second.first);
|
||||
state->nBlocksInFlightValidHeaders -= itInFlight->second.second->fValidatedHeaders;
|
||||
@ -324,7 +322,7 @@ void MarkBlockAsInFlight(NodeId nodeid, const uint256& hash, const Consensus::Pa
|
||||
MarkBlockAsReceived(hash);
|
||||
|
||||
QueuedBlock newentry = {hash, pindex, pindex != NULL};
|
||||
list<QueuedBlock>::iterator it = state->vBlocksInFlight.insert(state->vBlocksInFlight.end(), newentry);
|
||||
std::list<QueuedBlock>::iterator it = state->vBlocksInFlight.insert(state->vBlocksInFlight.end(), newentry);
|
||||
state->nBlocksInFlight++;
|
||||
state->nBlocksInFlightValidHeaders += newentry.fValidatedHeaders;
|
||||
if (state->nBlocksInFlight == 1) {
|
||||
@ -560,7 +558,7 @@ bool AddOrphanTx(const CTransactionRef& tx, NodeId peer) EXCLUSIVE_LOCKS_REQUIRE
|
||||
|
||||
int EraseOrphanTx(uint256 hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
|
||||
{
|
||||
map<uint256, COrphanTx>::iterator it = mapOrphanTransactions.find(hash);
|
||||
std::map<uint256, COrphanTx>::iterator it = mapOrphanTransactions.find(hash);
|
||||
if (it == mapOrphanTransactions.end())
|
||||
return 0;
|
||||
BOOST_FOREACH(const CTxIn& txin, it->second.tx->vin)
|
||||
@ -579,10 +577,10 @@ int EraseOrphanTx(uint256 hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
|
||||
void EraseOrphansFor(NodeId peer)
|
||||
{
|
||||
int nErased = 0;
|
||||
map<uint256, COrphanTx>::iterator iter = mapOrphanTransactions.begin();
|
||||
std::map<uint256, COrphanTx>::iterator iter = mapOrphanTransactions.begin();
|
||||
while (iter != mapOrphanTransactions.end())
|
||||
{
|
||||
map<uint256, COrphanTx>::iterator maybeErase = iter++; // increment to avoid iterator becoming invalid
|
||||
std::map<uint256, COrphanTx>::iterator maybeErase = iter++; // increment to avoid iterator becoming invalid
|
||||
if (maybeErase->second.fromPeer == peer)
|
||||
{
|
||||
nErased += EraseOrphanTx(maybeErase->second.tx->GetHash());
|
||||
@ -601,10 +599,10 @@ unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans) EXCLUSIVE_LOCKS_REQUIRE
|
||||
// Sweep out expired orphan pool entries:
|
||||
int nErased = 0;
|
||||
int64_t nMinExpTime = nNow + ORPHAN_TX_EXPIRE_TIME - ORPHAN_TX_EXPIRE_INTERVAL;
|
||||
map<uint256, COrphanTx>::iterator iter = mapOrphanTransactions.begin();
|
||||
std::map<uint256, COrphanTx>::iterator iter = mapOrphanTransactions.begin();
|
||||
while (iter != mapOrphanTransactions.end())
|
||||
{
|
||||
map<uint256, COrphanTx>::iterator maybeErase = iter++;
|
||||
std::map<uint256, COrphanTx>::iterator maybeErase = iter++;
|
||||
if (maybeErase->second.nTimeExpire <= nNow) {
|
||||
nErased += EraseOrphanTx(maybeErase->second.tx->GetHash());
|
||||
} else {
|
||||
@ -619,7 +617,7 @@ unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans) EXCLUSIVE_LOCKS_REQUIRE
|
||||
{
|
||||
// Evict a random orphan:
|
||||
uint256 randomhash = GetRandHash();
|
||||
map<uint256, COrphanTx>::iterator it = mapOrphanTransactions.lower_bound(randomhash);
|
||||
std::map<uint256, COrphanTx>::iterator it = mapOrphanTransactions.lower_bound(randomhash);
|
||||
if (it == mapOrphanTransactions.end())
|
||||
it = mapOrphanTransactions.begin();
|
||||
EraseOrphanTx(it->first);
|
||||
@ -865,7 +863,7 @@ static void RelayAddress(const CAddress& addr, bool fReachable, CConnman& connma
|
||||
void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParams, CConnman& connman, std::atomic<bool>& interruptMsgProc)
|
||||
{
|
||||
std::deque<CInv>::iterator it = pfrom->vRecvGetData.begin();
|
||||
vector<CInv> vNotFound;
|
||||
std::vector<CInv> vNotFound;
|
||||
CNetMsgMaker msgMaker(pfrom->GetSendVersion());
|
||||
LOCK(cs_main);
|
||||
|
||||
@ -956,7 +954,7 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
|
||||
// Bypass PushInventory, this must send even if redundant,
|
||||
// and we want it right after the last block so they don't
|
||||
// wait for other stuff first.
|
||||
vector<CInv> vInv;
|
||||
std::vector<CInv> vInv;
|
||||
vInv.push_back(CInv(MSG_BLOCK, chainActive.Tip()->GetBlockHash()));
|
||||
connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::INV, vInv));
|
||||
pfrom->hashContinue.SetNull();
|
||||
@ -1123,7 +1121,7 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
|
||||
}
|
||||
}
|
||||
|
||||
bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, int64_t nTimeReceived, const CChainParams& chainparams, CConnman& connman, std::atomic<bool>& interruptMsgProc)
|
||||
bool static ProcessMessage(CNode* pfrom, std::string strCommand, CDataStream& vRecv, int64_t nTimeReceived, const CChainParams& chainparams, CConnman& connman, std::atomic<bool>& interruptMsgProc)
|
||||
{
|
||||
LogPrint("net", "received: %s (%u bytes) peer=%d\n", SanitizeString(strCommand), vRecv.size(), pfrom->id);
|
||||
|
||||
@ -1153,7 +1151,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
// Each connection can only send one version message
|
||||
if (pfrom->nVersion != 0)
|
||||
{
|
||||
connman.PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_DUPLICATE, string("Duplicate version message")));
|
||||
connman.PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_DUPLICATE, std::string("Duplicate version message")));
|
||||
LOCK(cs_main);
|
||||
Misbehaving(pfrom->GetId(), 1);
|
||||
return false;
|
||||
@ -1295,7 +1293,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
item.second.RelayTo(pfrom, connman);
|
||||
}
|
||||
|
||||
string remoteAddr;
|
||||
std::string remoteAddr;
|
||||
if (fLogIPs)
|
||||
remoteAddr = ", peeraddr=" + pfrom->addr.ToString();
|
||||
|
||||
@ -1351,7 +1349,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
|
||||
else if (strCommand == NetMsgType::ADDR)
|
||||
{
|
||||
vector<CAddress> vAddr;
|
||||
std::vector<CAddress> vAddr;
|
||||
vRecv >> vAddr;
|
||||
|
||||
// Don't want addr from older versions unless seeding
|
||||
@ -1365,7 +1363,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
}
|
||||
|
||||
// Store the new addresses
|
||||
vector<CAddress> vAddrOk;
|
||||
std::vector<CAddress> vAddrOk;
|
||||
int64_t nNow = GetAdjustedTime();
|
||||
int64_t nSince = nNow - 10 * 60;
|
||||
BOOST_FOREACH(CAddress& addr, vAddr)
|
||||
@ -1404,7 +1402,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
|
||||
else if (strCommand == NetMsgType::INV)
|
||||
{
|
||||
vector<CInv> vInv;
|
||||
std::vector<CInv> vInv;
|
||||
vRecv >> vInv;
|
||||
if (vInv.size() > MAX_INV_SZ)
|
||||
{
|
||||
@ -1488,7 +1486,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
|
||||
else if (strCommand == NetMsgType::GETDATA)
|
||||
{
|
||||
vector<CInv> vInv;
|
||||
std::vector<CInv> vInv;
|
||||
vRecv >> vInv;
|
||||
if (vInv.size() > MAX_INV_SZ)
|
||||
{
|
||||
@ -1583,7 +1581,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
}
|
||||
|
||||
// we must use CBlocks, as CBlockHeaders won't include the 0x00 nTx count at the end
|
||||
vector<CBlock> vHeaders;
|
||||
std::vector<CBlock> vHeaders;
|
||||
int nLimit = MAX_HEADERS_RESULTS;
|
||||
LogPrint("net", "getheaders %d to %s from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop.IsNull() ? "end" : hashStop.ToString(), pfrom->id);
|
||||
for (; pindex; pindex = chainActive.Next(pindex))
|
||||
@ -1611,8 +1609,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
return true;
|
||||
}
|
||||
|
||||
deque<COutPoint> vWorkQueue;
|
||||
vector<uint256> vEraseQueue;
|
||||
std::deque<COutPoint> vWorkQueue;
|
||||
std::vector<uint256> vEraseQueue;
|
||||
CTransactionRef ptx;
|
||||
CTxLockRequest txLockRequest;
|
||||
CDarksendBroadcastTx dstx;
|
||||
@ -1707,7 +1705,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
mempool.size(), mempool.DynamicMemoryUsage() / 1000);
|
||||
|
||||
// Recursively process any orphan transactions that depended on this one
|
||||
set<NodeId> setMisbehaving;
|
||||
std::set<NodeId> setMisbehaving;
|
||||
while (!vWorkQueue.empty()) {
|
||||
auto itByPrev = mapOrphanTransactionsByPrev.find(vWorkQueue.front());
|
||||
vWorkQueue.pop_front();
|
||||
@ -1950,7 +1948,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
// If this set of headers is valid and ends in a block with at least as
|
||||
// much work as our tip, download as much as possible.
|
||||
if (fCanDirectFetch && pindexLast->IsValid(BLOCK_VALID_TREE) && chainActive.Tip()->nChainWork <= pindexLast->nChainWork) {
|
||||
vector<CBlockIndex *> vToFetch;
|
||||
std::vector<CBlockIndex *> vToFetch;
|
||||
CBlockIndex *pindexWalk = pindexLast;
|
||||
// Calculate all the blocks we'd need to switch to pindexLast, up to a limit.
|
||||
while (pindexWalk && !chainActive.Contains(pindexWalk) && vToFetch.size() <= MAX_BLOCKS_IN_TRANSIT_PER_PEER) {
|
||||
@ -1970,7 +1968,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
pindexLast->GetBlockHash().ToString(),
|
||||
pindexLast->nHeight);
|
||||
} else {
|
||||
vector<CInv> vGetData;
|
||||
std::vector<CInv> vGetData;
|
||||
// Download as much as possible, from earliest to latest.
|
||||
BOOST_REVERSE_FOREACH(CBlockIndex *pindex, vToFetch) {
|
||||
if (nodestate->nBlocksInFlight >= MAX_BLOCKS_IN_TRANSIT_PER_PEER) {
|
||||
@ -2044,7 +2042,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
pfrom->fSentAddr = true;
|
||||
|
||||
pfrom->vAddrToSend.clear();
|
||||
vector<CAddress> vAddr = connman.GetAddresses();
|
||||
std::vector<CAddress> vAddr = connman.GetAddresses();
|
||||
FastRandomContext insecure_rand;
|
||||
BOOST_FOREACH(const CAddress &addr, vAddr)
|
||||
pfrom->PushAddress(addr, insecure_rand);
|
||||
@ -2199,7 +2197,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
|
||||
else if (strCommand == NetMsgType::FILTERADD)
|
||||
{
|
||||
vector<unsigned char> vData;
|
||||
std::vector<unsigned char> vData;
|
||||
vRecv >> vData;
|
||||
|
||||
// Nodes must NEVER send a data item > 520 bytes (the max size for a script data object,
|
||||
@ -2237,10 +2235,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
{
|
||||
if (fDebug) {
|
||||
try {
|
||||
string strMsg; unsigned char ccode; string strReason;
|
||||
std::string strMsg; unsigned char ccode; std::string strReason;
|
||||
vRecv >> LIMITED_STRING(strMsg, CMessageHeader::COMMAND_SIZE) >> ccode >> LIMITED_STRING(strReason, MAX_REJECT_MESSAGE_LENGTH);
|
||||
|
||||
ostringstream ss;
|
||||
std::ostringstream ss;
|
||||
ss << strMsg << " code " << itostr(ccode) << ": " << strReason;
|
||||
|
||||
if (strMsg == NetMsgType::BLOCK || strMsg == NetMsgType::TX)
|
||||
@ -2362,7 +2360,7 @@ bool ProcessMessages(CNode* pfrom, CConnman& connman, std::atomic<bool>& interru
|
||||
LogPrintf("PROCESSMESSAGE: ERRORS IN HEADER %s peer=%d\n", SanitizeString(hdr.GetCommand()), pfrom->id);
|
||||
return fMoreWork;
|
||||
}
|
||||
string strCommand = hdr.GetCommand();
|
||||
std::string strCommand = hdr.GetCommand();
|
||||
|
||||
// Message size
|
||||
unsigned int nMessageSize = hdr.nMessageSize;
|
||||
@ -2391,7 +2389,7 @@ bool ProcessMessages(CNode* pfrom, CConnman& connman, std::atomic<bool>& interru
|
||||
}
|
||||
catch (const std::ios_base::failure& e)
|
||||
{
|
||||
connman.PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_MALFORMED, string("error parsing message")));
|
||||
connman.PushMessage(pfrom, CNetMsgMaker(INIT_PROTO_VERSION).Make(NetMsgType::REJECT, strCommand, REJECT_MALFORMED, std::string("error parsing message")));
|
||||
if (strstr(e.what(), "end of data"))
|
||||
{
|
||||
// Allow exceptions from under-length message on vRecv
|
||||
@ -2489,7 +2487,7 @@ bool SendMessages(CNode* pto, CConnman& connman, std::atomic<bool>& interruptMsg
|
||||
CNodeState &state = *State(pto->GetId());
|
||||
|
||||
BOOST_FOREACH(const CBlockReject& reject, state.rejects)
|
||||
connman.PushMessage(pto, msgMaker.Make(NetMsgType::REJECT, (string)NetMsgType::BLOCK, reject.chRejectCode, reject.strRejectReason, reject.hashBlock));
|
||||
connman.PushMessage(pto, msgMaker.Make(NetMsgType::REJECT, (std::string)NetMsgType::BLOCK, reject.chRejectCode, reject.strRejectReason, reject.hashBlock));
|
||||
state.rejects.clear();
|
||||
|
||||
if (state.fShouldBan) {
|
||||
@ -2522,7 +2520,7 @@ bool SendMessages(CNode* pto, CConnman& connman, std::atomic<bool>& interruptMsg
|
||||
//
|
||||
if (pto->nNextAddrSend < nNow) {
|
||||
pto->nNextAddrSend = PoissonNextSend(nNow, AVG_ADDRESS_BROADCAST_INTERVAL);
|
||||
vector<CAddress> vAddr;
|
||||
std::vector<CAddress> vAddr;
|
||||
vAddr.reserve(pto->vAddrToSend.size());
|
||||
BOOST_FOREACH(const CAddress& addr, pto->vAddrToSend)
|
||||
{
|
||||
@ -2602,7 +2600,7 @@ bool SendMessages(CNode* pto, CConnman& connman, std::atomic<bool>& interruptMsg
|
||||
// blocks, or if the peer doesn't want headers, just
|
||||
// add all to the inv queue.
|
||||
LOCK(pto->cs_inventory);
|
||||
vector<CBlock> vHeaders;
|
||||
std::vector<CBlock> vHeaders;
|
||||
bool fRevertToInv = (!state.fPreferHeaders || pto->vBlockHashesToAnnounce.size() > MAX_BLOCKS_TO_ANNOUNCE);
|
||||
CBlockIndex *pBestIndex = NULL; // last header queued for delivery
|
||||
ProcessBlockAvailability(pto->id); // ensure pindexBestKnownBlock is up-to-date
|
||||
@ -2699,7 +2697,7 @@ bool SendMessages(CNode* pto, CConnman& connman, std::atomic<bool>& interruptMsg
|
||||
//
|
||||
// Message: inventory
|
||||
//
|
||||
vector<CInv> vInv;
|
||||
std::vector<CInv> vInv;
|
||||
{
|
||||
LOCK(pto->cs_inventory);
|
||||
vInv.reserve(std::max<size_t>(pto->vInventoryBlockToSend.size(), INVENTORY_BROADCAST_MAX));
|
||||
@ -2766,7 +2764,7 @@ bool SendMessages(CNode* pto, CConnman& connman, std::atomic<bool>& interruptMsg
|
||||
// Determine transactions to relay
|
||||
if (fSendTrickle) {
|
||||
// Produce a vector with all candidates for sending
|
||||
vector<std::set<uint256>::iterator> vInvTx;
|
||||
std::vector<std::set<uint256>::iterator> vInvTx;
|
||||
vInvTx.reserve(pto->setInventoryTxToSend.size());
|
||||
for (std::set<uint256>::iterator it = pto->setInventoryTxToSend.begin(); it != pto->setInventoryTxToSend.end(); it++) {
|
||||
vInvTx.push_back(it);
|
||||
@ -2903,9 +2901,9 @@ bool SendMessages(CNode* pto, CConnman& connman, std::atomic<bool>& interruptMsg
|
||||
//
|
||||
// Message: getdata (blocks)
|
||||
//
|
||||
vector<CInv> vGetData;
|
||||
std::vector<CInv> vGetData;
|
||||
if (!pto->fClient && (fFetch || !IsInitialBlockDownload()) && state.nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER) {
|
||||
vector<CBlockIndex*> vToDownload;
|
||||
std::vector<CBlockIndex*> vToDownload;
|
||||
NodeId staller = -1;
|
||||
FindNextBlocksToDownload(pto->GetId(), MAX_BLOCKS_IN_TRANSIT_PER_PEER - state.nBlocksInFlight, vToDownload, staller, consensusParams);
|
||||
BOOST_FOREACH(CBlockIndex *pindex, vToDownload) {
|
||||
|
52
src/rest.cpp
52
src/rest.cpp
@ -20,8 +20,6 @@
|
||||
|
||||
#include <univalue.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
static const size_t MAX_GETUTXOS_OUTPOINTS = 15; //allow a max of 15 outpoints to be queried at once
|
||||
|
||||
enum RetFormat {
|
||||
@ -67,7 +65,7 @@ extern UniValue mempoolToJSON(bool fVerbose = false);
|
||||
extern void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex);
|
||||
extern UniValue blockheaderToJSON(const CBlockIndex* blockindex);
|
||||
|
||||
static bool RESTERR(HTTPRequest* req, enum HTTPStatusCode status, string message)
|
||||
static bool RESTERR(HTTPRequest* req, enum HTTPStatusCode status, std::string message)
|
||||
{
|
||||
req->WriteHeader("Content-Type", "text/plain");
|
||||
req->WriteReply(status, message + "\r\n");
|
||||
@ -95,9 +93,9 @@ static enum RetFormat ParseDataFormat(std::string& param, const std::string& str
|
||||
return rf_names[0].rf;
|
||||
}
|
||||
|
||||
static string AvailableDataFormatsString()
|
||||
static std::string AvailableDataFormatsString()
|
||||
{
|
||||
string formats = "";
|
||||
std::string formats = "";
|
||||
for (unsigned int i = 0; i < ARRAYLEN(rf_names); i++)
|
||||
if (strlen(rf_names[i].name) > 0) {
|
||||
formats.append(".");
|
||||
@ -111,7 +109,7 @@ static string AvailableDataFormatsString()
|
||||
return formats;
|
||||
}
|
||||
|
||||
static bool ParseHashStr(const string& strReq, uint256& v)
|
||||
static bool ParseHashStr(const std::string& strReq, uint256& v)
|
||||
{
|
||||
if (!IsHex(strReq) || (strReq.size() != 64))
|
||||
return false;
|
||||
@ -135,7 +133,7 @@ static bool rest_headers(HTTPRequest* req,
|
||||
return false;
|
||||
std::string param;
|
||||
const RetFormat rf = ParseDataFormat(param, strURIPart);
|
||||
vector<string> path;
|
||||
std::vector<std::string> path;
|
||||
boost::split(path, param, boost::is_any_of("/"));
|
||||
|
||||
if (path.size() != 2)
|
||||
@ -145,7 +143,7 @@ static bool rest_headers(HTTPRequest* req,
|
||||
if (count < 1 || count > 2000)
|
||||
return RESTERR(req, HTTP_BAD_REQUEST, "Header count out of range: " + path[0]);
|
||||
|
||||
string hashStr = path[1];
|
||||
std::string hashStr = path[1];
|
||||
uint256 hash;
|
||||
if (!ParseHashStr(hashStr, hash))
|
||||
return RESTERR(req, HTTP_BAD_REQUEST, "Invalid hash: " + hashStr);
|
||||
@ -171,14 +169,14 @@ static bool rest_headers(HTTPRequest* req,
|
||||
|
||||
switch (rf) {
|
||||
case RF_BINARY: {
|
||||
string binaryHeader = ssHeader.str();
|
||||
std::string binaryHeader = ssHeader.str();
|
||||
req->WriteHeader("Content-Type", "application/octet-stream");
|
||||
req->WriteReply(HTTP_OK, binaryHeader);
|
||||
return true;
|
||||
}
|
||||
|
||||
case RF_HEX: {
|
||||
string strHex = HexStr(ssHeader.begin(), ssHeader.end()) + "\n";
|
||||
std::string strHex = HexStr(ssHeader.begin(), ssHeader.end()) + "\n";
|
||||
req->WriteHeader("Content-Type", "text/plain");
|
||||
req->WriteReply(HTTP_OK, strHex);
|
||||
return true;
|
||||
@ -188,7 +186,7 @@ static bool rest_headers(HTTPRequest* req,
|
||||
BOOST_FOREACH(const CBlockIndex *pindex, headers) {
|
||||
jsonHeaders.push_back(blockheaderToJSON(pindex));
|
||||
}
|
||||
string strJSON = jsonHeaders.write() + "\n";
|
||||
std::string strJSON = jsonHeaders.write() + "\n";
|
||||
req->WriteHeader("Content-Type", "application/json");
|
||||
req->WriteReply(HTTP_OK, strJSON);
|
||||
return true;
|
||||
@ -235,14 +233,14 @@ static bool rest_block(HTTPRequest* req,
|
||||
|
||||
switch (rf) {
|
||||
case RF_BINARY: {
|
||||
string binaryBlock = ssBlock.str();
|
||||
std::string binaryBlock = ssBlock.str();
|
||||
req->WriteHeader("Content-Type", "application/octet-stream");
|
||||
req->WriteReply(HTTP_OK, binaryBlock);
|
||||
return true;
|
||||
}
|
||||
|
||||
case RF_HEX: {
|
||||
string strHex = HexStr(ssBlock.begin(), ssBlock.end()) + "\n";
|
||||
std::string strHex = HexStr(ssBlock.begin(), ssBlock.end()) + "\n";
|
||||
req->WriteHeader("Content-Type", "text/plain");
|
||||
req->WriteReply(HTTP_OK, strHex);
|
||||
return true;
|
||||
@ -250,7 +248,7 @@ static bool rest_block(HTTPRequest* req,
|
||||
|
||||
case RF_JSON: {
|
||||
UniValue objBlock = blockToJSON(block, pblockindex, showTxDetails);
|
||||
string strJSON = objBlock.write() + "\n";
|
||||
std::string strJSON = objBlock.write() + "\n";
|
||||
req->WriteHeader("Content-Type", "application/json");
|
||||
req->WriteReply(HTTP_OK, strJSON);
|
||||
return true;
|
||||
@ -290,7 +288,7 @@ static bool rest_chaininfo(HTTPRequest* req, const std::string& strURIPart)
|
||||
JSONRPCRequest jsonRequest;
|
||||
jsonRequest.params = UniValue(UniValue::VARR);
|
||||
UniValue chainInfoObject = getblockchaininfo(jsonRequest);
|
||||
string strJSON = chainInfoObject.write() + "\n";
|
||||
std::string strJSON = chainInfoObject.write() + "\n";
|
||||
req->WriteHeader("Content-Type", "application/json");
|
||||
req->WriteReply(HTTP_OK, strJSON);
|
||||
return true;
|
||||
@ -315,7 +313,7 @@ static bool rest_mempool_info(HTTPRequest* req, const std::string& strURIPart)
|
||||
case RF_JSON: {
|
||||
UniValue mempoolInfoObject = mempoolInfoToJSON();
|
||||
|
||||
string strJSON = mempoolInfoObject.write() + "\n";
|
||||
std::string strJSON = mempoolInfoObject.write() + "\n";
|
||||
req->WriteHeader("Content-Type", "application/json");
|
||||
req->WriteReply(HTTP_OK, strJSON);
|
||||
return true;
|
||||
@ -340,7 +338,7 @@ static bool rest_mempool_contents(HTTPRequest* req, const std::string& strURIPar
|
||||
case RF_JSON: {
|
||||
UniValue mempoolObject = mempoolToJSON(true);
|
||||
|
||||
string strJSON = mempoolObject.write() + "\n";
|
||||
std::string strJSON = mempoolObject.write() + "\n";
|
||||
req->WriteHeader("Content-Type", "application/json");
|
||||
req->WriteReply(HTTP_OK, strJSON);
|
||||
return true;
|
||||
@ -375,14 +373,14 @@ static bool rest_tx(HTTPRequest* req, const std::string& strURIPart)
|
||||
|
||||
switch (rf) {
|
||||
case RF_BINARY: {
|
||||
string binaryTx = ssTx.str();
|
||||
std::string binaryTx = ssTx.str();
|
||||
req->WriteHeader("Content-Type", "application/octet-stream");
|
||||
req->WriteReply(HTTP_OK, binaryTx);
|
||||
return true;
|
||||
}
|
||||
|
||||
case RF_HEX: {
|
||||
string strHex = HexStr(ssTx.begin(), ssTx.end()) + "\n";
|
||||
std::string strHex = HexStr(ssTx.begin(), ssTx.end()) + "\n";
|
||||
req->WriteHeader("Content-Type", "text/plain");
|
||||
req->WriteReply(HTTP_OK, strHex);
|
||||
return true;
|
||||
@ -391,7 +389,7 @@ static bool rest_tx(HTTPRequest* req, const std::string& strURIPart)
|
||||
case RF_JSON: {
|
||||
UniValue objTx(UniValue::VOBJ);
|
||||
TxToJSON(*tx, hashBlock, objTx);
|
||||
string strJSON = objTx.write() + "\n";
|
||||
std::string strJSON = objTx.write() + "\n";
|
||||
req->WriteHeader("Content-Type", "application/json");
|
||||
req->WriteReply(HTTP_OK, strJSON);
|
||||
return true;
|
||||
@ -413,7 +411,7 @@ static bool rest_getutxos(HTTPRequest* req, const std::string& strURIPart)
|
||||
std::string param;
|
||||
const RetFormat rf = ParseDataFormat(param, strURIPart);
|
||||
|
||||
vector<string> uriParts;
|
||||
std::vector<std::string> uriParts;
|
||||
if (param.length() > 1)
|
||||
{
|
||||
std::string strUriParams = param.substr(1);
|
||||
@ -427,7 +425,7 @@ static bool rest_getutxos(HTTPRequest* req, const std::string& strURIPart)
|
||||
|
||||
bool fInputParsed = false;
|
||||
bool fCheckMemPool = false;
|
||||
vector<COutPoint> vOutPoints;
|
||||
std::vector<COutPoint> vOutPoints;
|
||||
|
||||
// parse/deserialize input
|
||||
// input-format = output-format, rest/getutxos/bin requires binary input, gives binary output, ...
|
||||
@ -501,8 +499,8 @@ static bool rest_getutxos(HTTPRequest* req, const std::string& strURIPart)
|
||||
return RESTERR(req, HTTP_BAD_REQUEST, strprintf("Error: max outpoints exceeded (max: %d, tried: %d)", MAX_GETUTXOS_OUTPOINTS, vOutPoints.size()));
|
||||
|
||||
// check spentness and form a bitmap (as well as a JSON capable human-readable string representation)
|
||||
vector<unsigned char> bitmap;
|
||||
vector<CCoin> outs;
|
||||
std::vector<unsigned char> bitmap;
|
||||
std::vector<CCoin> outs;
|
||||
std::string bitmapStringRepresentation;
|
||||
std::vector<bool> hits;
|
||||
bitmap.resize((vOutPoints.size() + 7) / 8);
|
||||
@ -538,7 +536,7 @@ static bool rest_getutxos(HTTPRequest* req, const std::string& strURIPart)
|
||||
// use exact same output as mentioned in Bip64
|
||||
CDataStream ssGetUTXOResponse(SER_NETWORK, PROTOCOL_VERSION);
|
||||
ssGetUTXOResponse << chainActive.Height() << chainActive.Tip()->GetBlockHash() << bitmap << outs;
|
||||
string ssGetUTXOResponseString = ssGetUTXOResponse.str();
|
||||
std::string ssGetUTXOResponseString = ssGetUTXOResponse.str();
|
||||
|
||||
req->WriteHeader("Content-Type", "application/octet-stream");
|
||||
req->WriteReply(HTTP_OK, ssGetUTXOResponseString);
|
||||
@ -548,7 +546,7 @@ static bool rest_getutxos(HTTPRequest* req, const std::string& strURIPart)
|
||||
case RF_HEX: {
|
||||
CDataStream ssGetUTXOResponse(SER_NETWORK, PROTOCOL_VERSION);
|
||||
ssGetUTXOResponse << chainActive.Height() << chainActive.Tip()->GetBlockHash() << bitmap << outs;
|
||||
string strHex = HexStr(ssGetUTXOResponse.begin(), ssGetUTXOResponse.end()) + "\n";
|
||||
std::string strHex = HexStr(ssGetUTXOResponse.begin(), ssGetUTXOResponse.end()) + "\n";
|
||||
|
||||
req->WriteHeader("Content-Type", "text/plain");
|
||||
req->WriteReply(HTTP_OK, strHex);
|
||||
@ -579,7 +577,7 @@ static bool rest_getutxos(HTTPRequest* req, const std::string& strURIPart)
|
||||
objGetUTXOResponse.push_back(Pair("utxos", utxos));
|
||||
|
||||
// return json string
|
||||
string strJSON = objGetUTXOResponse.write() + "\n";
|
||||
std::string strJSON = objGetUTXOResponse.write() + "\n";
|
||||
req->WriteHeader("Content-Type", "application/json");
|
||||
req->WriteReply(HTTP_OK, strJSON);
|
||||
return true;
|
||||
|
@ -17,8 +17,6 @@
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
static CCriticalSection cs_nTimeOffset;
|
||||
static int64_t nTimeOffset = 0;
|
||||
|
||||
@ -51,7 +49,7 @@ void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample)
|
||||
{
|
||||
LOCK(cs_nTimeOffset);
|
||||
// Ignore duplicates
|
||||
static set<CNetAddr> setKnown;
|
||||
static std::set<CNetAddr> setKnown;
|
||||
if (setKnown.size() == BITCOIN_TIMEDATA_MAX_SAMPLES)
|
||||
return;
|
||||
if (!setKnown.insert(ip).second)
|
||||
|
42
src/txdb.cpp
42
src/txdb.cpp
@ -16,8 +16,6 @@
|
||||
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
static const char DB_COIN = 'C';
|
||||
static const char DB_COINS = 'c';
|
||||
static const char DB_BLOCK_FILES = 'f';
|
||||
@ -110,7 +108,7 @@ CBlockTreeDB::CBlockTreeDB(size_t nCacheSize, bool fMemory, bool fWipe) : CDBWra
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::ReadBlockFileInfo(int nFile, CBlockFileInfo &info) {
|
||||
return Read(make_pair(DB_BLOCK_FILES, nFile), info);
|
||||
return Read(std::make_pair(DB_BLOCK_FILES, nFile), info);
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::WriteReindexing(bool fReindexing) {
|
||||
@ -186,37 +184,37 @@ void CCoinsViewDBCursor::Next()
|
||||
bool CBlockTreeDB::WriteBatchSync(const std::vector<std::pair<int, const CBlockFileInfo*> >& fileInfo, int nLastFile, const std::vector<const CBlockIndex*>& blockinfo) {
|
||||
CDBBatch batch(*this);
|
||||
for (std::vector<std::pair<int, const CBlockFileInfo*> >::const_iterator it=fileInfo.begin(); it != fileInfo.end(); it++) {
|
||||
batch.Write(make_pair(DB_BLOCK_FILES, it->first), *it->second);
|
||||
batch.Write(std::make_pair(DB_BLOCK_FILES, it->first), *it->second);
|
||||
}
|
||||
batch.Write(DB_LAST_BLOCK, nLastFile);
|
||||
for (std::vector<const CBlockIndex*>::const_iterator it=blockinfo.begin(); it != blockinfo.end(); it++) {
|
||||
batch.Write(make_pair(DB_BLOCK_INDEX, (*it)->GetBlockHash()), CDiskBlockIndex(*it));
|
||||
batch.Write(std::make_pair(DB_BLOCK_INDEX, (*it)->GetBlockHash()), CDiskBlockIndex(*it));
|
||||
}
|
||||
return WriteBatch(batch, true);
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::ReadTxIndex(const uint256 &txid, CDiskTxPos &pos) {
|
||||
return Read(make_pair(DB_TXINDEX, txid), pos);
|
||||
return Read(std::make_pair(DB_TXINDEX, txid), pos);
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::WriteTxIndex(const std::vector<std::pair<uint256, CDiskTxPos> >&vect) {
|
||||
CDBBatch batch(*this);
|
||||
for (std::vector<std::pair<uint256,CDiskTxPos> >::const_iterator it=vect.begin(); it!=vect.end(); it++)
|
||||
batch.Write(make_pair(DB_TXINDEX, it->first), it->second);
|
||||
batch.Write(std::make_pair(DB_TXINDEX, it->first), it->second);
|
||||
return WriteBatch(batch);
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::ReadSpentIndex(CSpentIndexKey &key, CSpentIndexValue &value) {
|
||||
return Read(make_pair(DB_SPENTINDEX, key), value);
|
||||
return Read(std::make_pair(DB_SPENTINDEX, key), value);
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::UpdateSpentIndex(const std::vector<std::pair<CSpentIndexKey, CSpentIndexValue> >&vect) {
|
||||
CDBBatch batch(*this);
|
||||
for (std::vector<std::pair<CSpentIndexKey,CSpentIndexValue> >::const_iterator it=vect.begin(); it!=vect.end(); it++) {
|
||||
if (it->second.IsNull()) {
|
||||
batch.Erase(make_pair(DB_SPENTINDEX, it->first));
|
||||
batch.Erase(std::make_pair(DB_SPENTINDEX, it->first));
|
||||
} else {
|
||||
batch.Write(make_pair(DB_SPENTINDEX, it->first), it->second);
|
||||
batch.Write(std::make_pair(DB_SPENTINDEX, it->first), it->second);
|
||||
}
|
||||
}
|
||||
return WriteBatch(batch);
|
||||
@ -226,9 +224,9 @@ bool CBlockTreeDB::UpdateAddressUnspentIndex(const std::vector<std::pair<CAddres
|
||||
CDBBatch batch(*this);
|
||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=vect.begin(); it!=vect.end(); it++) {
|
||||
if (it->second.IsNull()) {
|
||||
batch.Erase(make_pair(DB_ADDRESSUNSPENTINDEX, it->first));
|
||||
batch.Erase(std::make_pair(DB_ADDRESSUNSPENTINDEX, it->first));
|
||||
} else {
|
||||
batch.Write(make_pair(DB_ADDRESSUNSPENTINDEX, it->first), it->second);
|
||||
batch.Write(std::make_pair(DB_ADDRESSUNSPENTINDEX, it->first), it->second);
|
||||
}
|
||||
}
|
||||
return WriteBatch(batch);
|
||||
@ -239,7 +237,7 @@ bool CBlockTreeDB::ReadAddressUnspentIndex(uint160 addressHash, int type,
|
||||
|
||||
std::unique_ptr<CDBIterator> pcursor(NewIterator());
|
||||
|
||||
pcursor->Seek(make_pair(DB_ADDRESSUNSPENTINDEX, CAddressIndexIteratorKey(type, addressHash)));
|
||||
pcursor->Seek(std::make_pair(DB_ADDRESSUNSPENTINDEX, CAddressIndexIteratorKey(type, addressHash)));
|
||||
|
||||
while (pcursor->Valid()) {
|
||||
boost::this_thread::interruption_point();
|
||||
@ -247,7 +245,7 @@ bool CBlockTreeDB::ReadAddressUnspentIndex(uint160 addressHash, int type,
|
||||
if (pcursor->GetKey(key) && key.first == DB_ADDRESSUNSPENTINDEX && key.second.hashBytes == addressHash) {
|
||||
CAddressUnspentValue nValue;
|
||||
if (pcursor->GetValue(nValue)) {
|
||||
unspentOutputs.push_back(make_pair(key.second, nValue));
|
||||
unspentOutputs.push_back(std::make_pair(key.second, nValue));
|
||||
pcursor->Next();
|
||||
} else {
|
||||
return error("failed to get address unspent value");
|
||||
@ -263,14 +261,14 @@ bool CBlockTreeDB::ReadAddressUnspentIndex(uint160 addressHash, int type,
|
||||
bool CBlockTreeDB::WriteAddressIndex(const std::vector<std::pair<CAddressIndexKey, CAmount > >&vect) {
|
||||
CDBBatch batch(*this);
|
||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=vect.begin(); it!=vect.end(); it++)
|
||||
batch.Write(make_pair(DB_ADDRESSINDEX, it->first), it->second);
|
||||
batch.Write(std::make_pair(DB_ADDRESSINDEX, it->first), it->second);
|
||||
return WriteBatch(batch);
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::EraseAddressIndex(const std::vector<std::pair<CAddressIndexKey, CAmount > >&vect) {
|
||||
CDBBatch batch(*this);
|
||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=vect.begin(); it!=vect.end(); it++)
|
||||
batch.Erase(make_pair(DB_ADDRESSINDEX, it->first));
|
||||
batch.Erase(std::make_pair(DB_ADDRESSINDEX, it->first));
|
||||
return WriteBatch(batch);
|
||||
}
|
||||
|
||||
@ -281,9 +279,9 @@ bool CBlockTreeDB::ReadAddressIndex(uint160 addressHash, int type,
|
||||
std::unique_ptr<CDBIterator> pcursor(NewIterator());
|
||||
|
||||
if (start > 0 && end > 0) {
|
||||
pcursor->Seek(make_pair(DB_ADDRESSINDEX, CAddressIndexIteratorHeightKey(type, addressHash, start)));
|
||||
pcursor->Seek(std::make_pair(DB_ADDRESSINDEX, CAddressIndexIteratorHeightKey(type, addressHash, start)));
|
||||
} else {
|
||||
pcursor->Seek(make_pair(DB_ADDRESSINDEX, CAddressIndexIteratorKey(type, addressHash)));
|
||||
pcursor->Seek(std::make_pair(DB_ADDRESSINDEX, CAddressIndexIteratorKey(type, addressHash)));
|
||||
}
|
||||
|
||||
while (pcursor->Valid()) {
|
||||
@ -295,7 +293,7 @@ bool CBlockTreeDB::ReadAddressIndex(uint160 addressHash, int type,
|
||||
}
|
||||
CAmount nValue;
|
||||
if (pcursor->GetValue(nValue)) {
|
||||
addressIndex.push_back(make_pair(key.second, nValue));
|
||||
addressIndex.push_back(std::make_pair(key.second, nValue));
|
||||
pcursor->Next();
|
||||
} else {
|
||||
return error("failed to get address index value");
|
||||
@ -310,7 +308,7 @@ bool CBlockTreeDB::ReadAddressIndex(uint160 addressHash, int type,
|
||||
|
||||
bool CBlockTreeDB::WriteTimestampIndex(const CTimestampIndexKey ×tampIndex) {
|
||||
CDBBatch batch(*this);
|
||||
batch.Write(make_pair(DB_TIMESTAMPINDEX, timestampIndex), 0);
|
||||
batch.Write(std::make_pair(DB_TIMESTAMPINDEX, timestampIndex), 0);
|
||||
return WriteBatch(batch);
|
||||
}
|
||||
|
||||
@ -318,7 +316,7 @@ bool CBlockTreeDB::ReadTimestampIndex(const unsigned int &high, const unsigned i
|
||||
|
||||
std::unique_ptr<CDBIterator> pcursor(NewIterator());
|
||||
|
||||
pcursor->Seek(make_pair(DB_TIMESTAMPINDEX, CTimestampIndexIteratorKey(low)));
|
||||
pcursor->Seek(std::make_pair(DB_TIMESTAMPINDEX, CTimestampIndexIteratorKey(low)));
|
||||
|
||||
while (pcursor->Valid()) {
|
||||
boost::this_thread::interruption_point();
|
||||
@ -350,7 +348,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts(boost::function<CBlockIndex*(const uint256
|
||||
{
|
||||
std::unique_ptr<CDBIterator> pcursor(NewIterator());
|
||||
|
||||
pcursor->Seek(make_pair(DB_BLOCK_INDEX, uint256()));
|
||||
pcursor->Seek(std::make_pair(DB_BLOCK_INDEX, uint256()));
|
||||
|
||||
// Load mapBlockIndex
|
||||
while (pcursor->Valid()) {
|
||||
|
@ -20,8 +20,6 @@
|
||||
#include "version.h"
|
||||
#include "hash.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
CTxMemPoolEntry::CTxMemPoolEntry(const CTransactionRef& _tx, const CAmount& _nFee,
|
||||
int64_t _nTime, double _entryPriority, unsigned int _entryHeight,
|
||||
CAmount _inChainInputValue,
|
||||
@ -449,22 +447,22 @@ void CTxMemPool::addAddressIndex(const CTxMemPoolEntry &entry, const CCoinsViewC
|
||||
const Coin& coin = view.AccessCoin(input.prevout);
|
||||
const CTxOut &prevout = coin.out;
|
||||
if (prevout.scriptPubKey.IsPayToScriptHash()) {
|
||||
vector<unsigned char> hashBytes(prevout.scriptPubKey.begin()+2, prevout.scriptPubKey.begin()+22);
|
||||
std::vector<unsigned char> hashBytes(prevout.scriptPubKey.begin()+2, prevout.scriptPubKey.begin()+22);
|
||||
CMempoolAddressDeltaKey key(2, uint160(hashBytes), txhash, j, 1);
|
||||
CMempoolAddressDelta delta(entry.GetTime(), prevout.nValue * -1, input.prevout.hash, input.prevout.n);
|
||||
mapAddress.insert(make_pair(key, delta));
|
||||
mapAddress.insert(std::make_pair(key, delta));
|
||||
inserted.push_back(key);
|
||||
} else if (prevout.scriptPubKey.IsPayToPublicKeyHash()) {
|
||||
vector<unsigned char> hashBytes(prevout.scriptPubKey.begin()+3, prevout.scriptPubKey.begin()+23);
|
||||
std::vector<unsigned char> hashBytes(prevout.scriptPubKey.begin()+3, prevout.scriptPubKey.begin()+23);
|
||||
CMempoolAddressDeltaKey key(1, uint160(hashBytes), txhash, j, 1);
|
||||
CMempoolAddressDelta delta(entry.GetTime(), prevout.nValue * -1, input.prevout.hash, input.prevout.n);
|
||||
mapAddress.insert(make_pair(key, delta));
|
||||
mapAddress.insert(std::make_pair(key, delta));
|
||||
inserted.push_back(key);
|
||||
} else if (prevout.scriptPubKey.IsPayToPublicKey()) {
|
||||
uint160 hashBytes(Hash160(prevout.scriptPubKey.begin()+1, prevout.scriptPubKey.end()-1));
|
||||
CMempoolAddressDeltaKey key(1, hashBytes, txhash, j, 1);
|
||||
CMempoolAddressDelta delta(entry.GetTime(), prevout.nValue * -1, input.prevout.hash, input.prevout.n);
|
||||
mapAddress.insert(make_pair(key, delta));
|
||||
mapAddress.insert(std::make_pair(key, delta));
|
||||
inserted.push_back(key);
|
||||
}
|
||||
}
|
||||
@ -472,26 +470,26 @@ void CTxMemPool::addAddressIndex(const CTxMemPoolEntry &entry, const CCoinsViewC
|
||||
for (unsigned int k = 0; k < tx.vout.size(); k++) {
|
||||
const CTxOut &out = tx.vout[k];
|
||||
if (out.scriptPubKey.IsPayToScriptHash()) {
|
||||
vector<unsigned char> hashBytes(out.scriptPubKey.begin()+2, out.scriptPubKey.begin()+22);
|
||||
std::vector<unsigned char> hashBytes(out.scriptPubKey.begin()+2, out.scriptPubKey.begin()+22);
|
||||
CMempoolAddressDeltaKey key(2, uint160(hashBytes), txhash, k, 0);
|
||||
mapAddress.insert(make_pair(key, CMempoolAddressDelta(entry.GetTime(), out.nValue)));
|
||||
mapAddress.insert(std::make_pair(key, CMempoolAddressDelta(entry.GetTime(), out.nValue)));
|
||||
inserted.push_back(key);
|
||||
} else if (out.scriptPubKey.IsPayToPublicKeyHash()) {
|
||||
vector<unsigned char> hashBytes(out.scriptPubKey.begin()+3, out.scriptPubKey.begin()+23);
|
||||
std::vector<unsigned char> hashBytes(out.scriptPubKey.begin()+3, out.scriptPubKey.begin()+23);
|
||||
std::pair<addressDeltaMap::iterator,bool> ret;
|
||||
CMempoolAddressDeltaKey key(1, uint160(hashBytes), txhash, k, 0);
|
||||
mapAddress.insert(make_pair(key, CMempoolAddressDelta(entry.GetTime(), out.nValue)));
|
||||
mapAddress.insert(std::make_pair(key, CMempoolAddressDelta(entry.GetTime(), out.nValue)));
|
||||
inserted.push_back(key);
|
||||
} else if (out.scriptPubKey.IsPayToPublicKey()) {
|
||||
uint160 hashBytes(Hash160(out.scriptPubKey.begin()+1, out.scriptPubKey.end()-1));
|
||||
std::pair<addressDeltaMap::iterator,bool> ret;
|
||||
CMempoolAddressDeltaKey key(1, hashBytes, txhash, k, 0);
|
||||
mapAddress.insert(make_pair(key, CMempoolAddressDelta(entry.GetTime(), out.nValue)));
|
||||
mapAddress.insert(std::make_pair(key, CMempoolAddressDelta(entry.GetTime(), out.nValue)));
|
||||
inserted.push_back(key);
|
||||
}
|
||||
}
|
||||
|
||||
mapAddressInserted.insert(make_pair(txhash, inserted));
|
||||
mapAddressInserted.insert(std::make_pair(txhash, inserted));
|
||||
}
|
||||
|
||||
bool CTxMemPool::getAddressIndex(std::vector<std::pair<uint160, int> > &addresses,
|
||||
@ -540,10 +538,10 @@ void CTxMemPool::addSpentIndex(const CTxMemPoolEntry &entry, const CCoinsViewCac
|
||||
int addressType;
|
||||
|
||||
if (prevout.scriptPubKey.IsPayToScriptHash()) {
|
||||
addressHash = uint160(vector<unsigned char> (prevout.scriptPubKey.begin()+2, prevout.scriptPubKey.begin()+22));
|
||||
addressHash = uint160(std::vector<unsigned char> (prevout.scriptPubKey.begin()+2, prevout.scriptPubKey.begin()+22));
|
||||
addressType = 2;
|
||||
} else if (prevout.scriptPubKey.IsPayToPublicKeyHash()) {
|
||||
addressHash = uint160(vector<unsigned char> (prevout.scriptPubKey.begin()+3, prevout.scriptPubKey.begin()+23));
|
||||
addressHash = uint160(std::vector<unsigned char> (prevout.scriptPubKey.begin()+3, prevout.scriptPubKey.begin()+23));
|
||||
addressType = 1;
|
||||
} else if (prevout.scriptPubKey.IsPayToPublicKey()) {
|
||||
addressHash = Hash160(prevout.scriptPubKey.begin()+1, prevout.scriptPubKey.end()-1);
|
||||
@ -556,7 +554,7 @@ void CTxMemPool::addSpentIndex(const CTxMemPoolEntry &entry, const CCoinsViewCac
|
||||
CSpentIndexKey key = CSpentIndexKey(input.prevout.hash, input.prevout.n);
|
||||
CSpentIndexValue value = CSpentIndexValue(txhash, j, -1, prevout.nValue, addressType, addressHash);
|
||||
|
||||
mapSpent.insert(make_pair(key, value));
|
||||
mapSpent.insert(std::make_pair(key, value));
|
||||
inserted.push_back(key);
|
||||
|
||||
}
|
||||
@ -794,7 +792,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
|
||||
const int64_t nSpendHeight = GetSpendHeight(mempoolDuplicate);
|
||||
|
||||
LOCK(cs);
|
||||
list<const CTxMemPoolEntry*> waitingOnDependants;
|
||||
std::list<const CTxMemPoolEntry*> waitingOnDependants;
|
||||
for (indexed_transaction_set::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) {
|
||||
unsigned int i = 0;
|
||||
checkTotal += it->GetTxSize();
|
||||
@ -951,7 +949,7 @@ std::vector<CTxMemPool::indexed_transaction_set::const_iterator> CTxMemPool::Get
|
||||
return iters;
|
||||
}
|
||||
|
||||
void CTxMemPool::queryHashes(vector<uint256>& vtxid)
|
||||
void CTxMemPool::queryHashes(std::vector<uint256>& vtxid)
|
||||
{
|
||||
LOCK(cs);
|
||||
auto iters = GetSortedDepthAndScore();
|
||||
@ -1055,7 +1053,7 @@ CTxMemPool::ReadFeeEstimates(CAutoFile& filein)
|
||||
return true;
|
||||
}
|
||||
|
||||
void CTxMemPool::PrioritiseTransaction(const uint256 hash, const string strHash, double dPriorityDelta, const CAmount& nFeeDelta)
|
||||
void CTxMemPool::PrioritiseTransaction(const uint256 hash, const std::string strHash, double dPriorityDelta, const CAmount& nFeeDelta)
|
||||
{
|
||||
{
|
||||
LOCK(cs);
|
||||
|
@ -54,8 +54,6 @@
|
||||
#include <boost/math/distributions/poisson.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#if defined(NDEBUG)
|
||||
# error "Dash Core cannot be compiled without assertions."
|
||||
#endif
|
||||
@ -112,7 +110,7 @@ static void CheckBlockIndex(const Consensus::Params& consensusParams);
|
||||
/** Constant stuff for coinbase transactions we create: */
|
||||
CScript COINBASE_FLAGS;
|
||||
|
||||
const string strMessageMagic = "DarkCoin Signed Message:\n";
|
||||
const std::string strMessageMagic = "DarkCoin Signed Message:\n";
|
||||
|
||||
// Internal stuff
|
||||
namespace {
|
||||
@ -145,11 +143,11 @@ namespace {
|
||||
* as good as our current tip or better. Entries may be failed, though, and pruning nodes may be
|
||||
* missing the data for the block.
|
||||
*/
|
||||
set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndexCandidates;
|
||||
std::set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndexCandidates;
|
||||
/** All pairs A->B, where A (or one of its ancestors) misses transactions, but B has transactions.
|
||||
* Pruned nodes may have entries where B is missing data.
|
||||
*/
|
||||
multimap<CBlockIndex*, CBlockIndex*> mapBlocksUnlinked;
|
||||
std::multimap<CBlockIndex*, CBlockIndex*> mapBlocksUnlinked;
|
||||
|
||||
CCriticalSection cs_LastBlockFile;
|
||||
std::vector<CBlockFileInfo> vinfoBlockFile;
|
||||
@ -173,10 +171,10 @@ namespace {
|
||||
arith_uint256 nLastPreciousChainwork = 0;
|
||||
|
||||
/** Dirty block index entries. */
|
||||
set<CBlockIndex*> setDirtyBlockIndex;
|
||||
std::set<CBlockIndex*> setDirtyBlockIndex;
|
||||
|
||||
/** Dirty block file entries. */
|
||||
set<int> setDirtyFileInfo;
|
||||
std::set<int> setDirtyFileInfo;
|
||||
} // anon namespace
|
||||
|
||||
/* Use this class to start tracking transactions that are removed from the
|
||||
@ -542,7 +540,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, bool fChe
|
||||
|
||||
// Check for duplicate inputs - note that this check is slow so we skip it in CheckBlock
|
||||
if (fCheckDuplicateInputs) {
|
||||
set<COutPoint> vInOutPoints;
|
||||
std::set<COutPoint> vInOutPoints;
|
||||
for (const auto& txin : tx.vin)
|
||||
{
|
||||
if (!vInOutPoints.insert(txin.prevout).second)
|
||||
@ -629,7 +627,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
|
||||
return state.DoS(100, false, REJECT_INVALID, "coinbase");
|
||||
|
||||
// Rather not work on nonstandard transactions (unless -testnet/-regtest)
|
||||
string reason;
|
||||
std::string reason;
|
||||
if (fRequireStandard && !IsStandardTx(tx, reason))
|
||||
return state.DoS(0, false, REJECT_NONSTANDARD, reason);
|
||||
|
||||
@ -659,7 +657,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
|
||||
}
|
||||
|
||||
// Check for conflicts with in-memory transactions
|
||||
set<uint256> setConflicts;
|
||||
std::set<uint256> setConflicts;
|
||||
{
|
||||
LOCK(pool.cs); // protect pool.mapNextTx
|
||||
BOOST_FOREACH(const CTxIn &txin, tx.vin)
|
||||
@ -888,7 +886,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
|
||||
if (fReplacementTransaction)
|
||||
{
|
||||
CFeeRate newFeeRate(nModifiedFees, nSize);
|
||||
set<uint256> setConflictsParents;
|
||||
std::set<uint256> setConflictsParents;
|
||||
const int maxDescendantsToVisit = 100;
|
||||
CTxMemPool::setEntries setIterConflicting;
|
||||
BOOST_FOREACH(const uint256 &hashConflicting, setConflicts)
|
||||
@ -2444,13 +2442,13 @@ bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode, int n
|
||||
{
|
||||
std::vector<std::pair<int, const CBlockFileInfo*> > vFiles;
|
||||
vFiles.reserve(setDirtyFileInfo.size());
|
||||
for (set<int>::iterator it = setDirtyFileInfo.begin(); it != setDirtyFileInfo.end(); ) {
|
||||
vFiles.push_back(make_pair(*it, &vinfoBlockFile[*it]));
|
||||
for (std::set<int>::iterator it = setDirtyFileInfo.begin(); it != setDirtyFileInfo.end(); ) {
|
||||
vFiles.push_back(std::make_pair(*it, &vinfoBlockFile[*it]));
|
||||
setDirtyFileInfo.erase(it++);
|
||||
}
|
||||
std::vector<const CBlockIndex*> vBlocks;
|
||||
vBlocks.reserve(setDirtyBlockIndex.size());
|
||||
for (set<CBlockIndex*>::iterator it = setDirtyBlockIndex.begin(); it != setDirtyBlockIndex.end(); ) {
|
||||
for (std::set<CBlockIndex*>::iterator it = setDirtyBlockIndex.begin(); it != setDirtyBlockIndex.end(); ) {
|
||||
vBlocks.push_back(*it);
|
||||
setDirtyBlockIndex.erase(it++);
|
||||
}
|
||||
@ -3096,7 +3094,7 @@ CBlockIndex* AddToBlockIndex(const CBlockHeader& block)
|
||||
// to avoid miners withholding blocks but broadcasting headers, to get a
|
||||
// competitive advantage.
|
||||
pindexNew->nSequenceId = 0;
|
||||
BlockMap::iterator mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first;
|
||||
BlockMap::iterator mi = mapBlockIndex.insert(std::make_pair(hash, pindexNew)).first;
|
||||
pindexNew->phashBlock = &((*mi).first);
|
||||
BlockMap::iterator miPrev = mapBlockIndex.find(block.hashPrevBlock);
|
||||
if (miPrev != mapBlockIndex.end())
|
||||
@ -3130,7 +3128,7 @@ bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBl
|
||||
|
||||
if (pindexNew->pprev == NULL || pindexNew->pprev->nChainTx) {
|
||||
// If pindexNew is the genesis block or all parents are BLOCK_VALID_TRANSACTIONS.
|
||||
deque<CBlockIndex*> queue;
|
||||
std::deque<CBlockIndex*> queue;
|
||||
queue.push_back(pindexNew);
|
||||
|
||||
// Recursively process any descendant blocks that now may be eligible to be connected.
|
||||
@ -3703,7 +3701,7 @@ void PruneOneBlockFile(const int fileNumber)
|
||||
|
||||
void UnlinkPrunedFiles(std::set<int>& setFilesToPrune)
|
||||
{
|
||||
for (set<int>::iterator it = setFilesToPrune.begin(); it != setFilesToPrune.end(); ++it) {
|
||||
for (std::set<int>::iterator it = setFilesToPrune.begin(); it != setFilesToPrune.end(); ++it) {
|
||||
CDiskBlockPos pos(*it, 0);
|
||||
boost::filesystem::remove(GetBlockPosFilename(pos, "blk"));
|
||||
boost::filesystem::remove(GetBlockPosFilename(pos, "rev"));
|
||||
@ -3721,7 +3719,7 @@ void FindFilesToPruneManual(std::set<int>& setFilesToPrune, int nManualPruneHeig
|
||||
return;
|
||||
|
||||
// last block to prune is the lesser of (user-specified height, MIN_BLOCKS_TO_KEEP from the tip)
|
||||
unsigned int nLastBlockWeCanPrune = min((unsigned)nManualPruneHeight, chainActive.Tip()->nHeight - MIN_BLOCKS_TO_KEEP);
|
||||
unsigned int nLastBlockWeCanPrune = std::min((unsigned)nManualPruneHeight, chainActive.Tip()->nHeight - MIN_BLOCKS_TO_KEEP);
|
||||
int count=0;
|
||||
for (int fileNumber = 0; fileNumber < nLastBlockFile; fileNumber++) {
|
||||
if (vinfoBlockFile[fileNumber].nSize == 0 || vinfoBlockFile[fileNumber].nHeightLast > nLastBlockWeCanPrune)
|
||||
@ -3848,8 +3846,8 @@ CBlockIndex * InsertBlockIndex(uint256 hash)
|
||||
// Create new
|
||||
CBlockIndex* pindexNew = new CBlockIndex();
|
||||
if (!pindexNew)
|
||||
throw runtime_error(std::string(__func__) + ": new CBlockIndex failed");
|
||||
mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first;
|
||||
throw std::runtime_error(std::string(__func__) + ": new CBlockIndex failed");
|
||||
mi = mapBlockIndex.insert(std::make_pair(hash, pindexNew)).first;
|
||||
pindexNew->phashBlock = &((*mi).first);
|
||||
|
||||
return pindexNew;
|
||||
@ -3863,12 +3861,12 @@ bool static LoadBlockIndexDB(const CChainParams& chainparams)
|
||||
boost::this_thread::interruption_point();
|
||||
|
||||
// Calculate nChainWork
|
||||
vector<pair<int, CBlockIndex*> > vSortedByHeight;
|
||||
std::vector<std::pair<int, CBlockIndex*> > vSortedByHeight;
|
||||
vSortedByHeight.reserve(mapBlockIndex.size());
|
||||
BOOST_FOREACH(const PAIRTYPE(uint256, CBlockIndex*)& item, mapBlockIndex)
|
||||
{
|
||||
CBlockIndex* pindex = item.second;
|
||||
vSortedByHeight.push_back(make_pair(pindex->nHeight, pindex));
|
||||
vSortedByHeight.push_back(std::make_pair(pindex->nHeight, pindex));
|
||||
}
|
||||
sort(vSortedByHeight.begin(), vSortedByHeight.end());
|
||||
BOOST_FOREACH(const PAIRTYPE(int, CBlockIndex*)& item, vSortedByHeight)
|
||||
@ -3919,7 +3917,7 @@ bool static LoadBlockIndexDB(const CChainParams& chainparams)
|
||||
|
||||
// Check presence of blk files
|
||||
LogPrintf("Checking all blk files are present...\n");
|
||||
set<int> setBlkDataFiles;
|
||||
std::set<int> setBlkDataFiles;
|
||||
BOOST_FOREACH(const PAIRTYPE(uint256, CBlockIndex*)& item, mapBlockIndex)
|
||||
{
|
||||
CBlockIndex* pindex = item.second;
|
||||
@ -4261,7 +4259,7 @@ bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, CDiskB
|
||||
NotifyHeaderTip();
|
||||
|
||||
// Recursively process earlier encountered successors of this block
|
||||
deque<uint256> queue;
|
||||
std::deque<uint256> queue;
|
||||
queue.push_back(hash);
|
||||
while (!queue.empty()) {
|
||||
uint256 head = queue.front();
|
||||
|
Loading…
Reference in New Issue
Block a user