use const references where appropriate
This commit is contained in:
committed by
Jack Grigg
parent
5e478618e6
commit
db954a65ac
@@ -50,7 +50,7 @@ std::string CUnsignedAlert::ToString() const
|
|||||||
BOOST_FOREACH(int n, setCancel)
|
BOOST_FOREACH(int n, setCancel)
|
||||||
strSetCancel += strprintf("%d ", n);
|
strSetCancel += strprintf("%d ", n);
|
||||||
std::string strSetSubVer;
|
std::string strSetSubVer;
|
||||||
BOOST_FOREACH(std::string str, setSubVer)
|
BOOST_FOREACH(const std::string& str, setSubVer)
|
||||||
strSetSubVer += "\"" + str + "\" ";
|
strSetSubVer += "\"" + str + "\" ";
|
||||||
return strprintf(
|
return strprintf(
|
||||||
"CAlert(\n"
|
"CAlert(\n"
|
||||||
@@ -112,7 +112,7 @@ bool CAlert::Cancels(const CAlert& alert) const
|
|||||||
return (alert.nID <= nCancel || setCancel.count(alert.nID));
|
return (alert.nID <= nCancel || setCancel.count(alert.nID));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAlert::AppliesTo(int nVersion, std::string strSubVerIn) const
|
bool CAlert::AppliesTo(int nVersion, const std::string& strSubVerIn) const
|
||||||
{
|
{
|
||||||
// TODO: rework for client-version-embedded-in-strSubVer ?
|
// TODO: rework for client-version-embedded-in-strSubVer ?
|
||||||
return (IsInEffect() &&
|
return (IsInEffect() &&
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public:
|
|||||||
uint256 GetHash() const;
|
uint256 GetHash() const;
|
||||||
bool IsInEffect() const;
|
bool IsInEffect() const;
|
||||||
bool Cancels(const CAlert& alert) const;
|
bool Cancels(const CAlert& alert) const;
|
||||||
bool AppliesTo(int nVersion, std::string strSubVerIn) const;
|
bool AppliesTo(int nVersion, const std::string& strSubVerIn) const;
|
||||||
bool AppliesToMe() const;
|
bool AppliesToMe() const;
|
||||||
bool RelayTo(CNode* pnode) const;
|
bool RelayTo(CNode* pnode) const;
|
||||||
bool CheckSignature(const std::vector<unsigned char>& alertKey) const;
|
bool CheckSignature(const std::vector<unsigned char>& alertKey) const;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
unsigned char _chRejectCode=0, std::string _strRejectReason="") {
|
unsigned char _chRejectCode=0, std::string _strRejectReason="") {
|
||||||
return DoS(0, ret, _chRejectCode, _strRejectReason);
|
return DoS(0, ret, _chRejectCode, _strRejectReason);
|
||||||
}
|
}
|
||||||
virtual bool Error(std::string strRejectReasonIn="") {
|
virtual bool Error(const std::string& strRejectReasonIn) {
|
||||||
if (mode == MODE_VALID)
|
if (mode == MODE_VALID)
|
||||||
strRejectReason = strRejectReasonIn;
|
strRejectReason = strRejectReasonIn;
|
||||||
mode = MODE_ERROR;
|
mode = MODE_ERROR;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class uint256;
|
|||||||
class UniValue;
|
class UniValue;
|
||||||
|
|
||||||
// core_read.cpp
|
// core_read.cpp
|
||||||
extern CScript ParseScript(std::string s);
|
extern CScript ParseScript(const std::string& s);
|
||||||
extern bool DecodeHexTx(CTransaction& tx, const std::string& strHexTx);
|
extern bool DecodeHexTx(CTransaction& tx, const std::string& strHexTx);
|
||||||
extern bool DecodeHexBlk(CBlock&, const std::string& strHexBlk);
|
extern bool DecodeHexBlk(CBlock&, const std::string& strHexBlk);
|
||||||
extern uint256 ParseHashUV(const UniValue& v, const std::string& strName);
|
extern uint256 ParseHashUV(const UniValue& v, const std::string& strName);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
CScript ParseScript(std::string s)
|
CScript ParseScript(const std::string& s)
|
||||||
{
|
{
|
||||||
CScript result;
|
CScript result;
|
||||||
|
|
||||||
|
|||||||
14
src/init.cpp
14
src/init.cpp
@@ -612,7 +612,7 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -loadblock=
|
// -loadblock=
|
||||||
BOOST_FOREACH(boost::filesystem::path &path, vImportFiles) {
|
BOOST_FOREACH(const boost::filesystem::path& path, vImportFiles) {
|
||||||
FILE *file = fopen(path.string().c_str(), "rb");
|
FILE *file = fopen(path.string().c_str(), "rb");
|
||||||
if (file) {
|
if (file) {
|
||||||
CImportingNow imp;
|
CImportingNow imp;
|
||||||
@@ -1113,7 +1113,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
|
|
||||||
if (mapArgs.count("-onlynet")) {
|
if (mapArgs.count("-onlynet")) {
|
||||||
std::set<enum Network> nets;
|
std::set<enum Network> nets;
|
||||||
BOOST_FOREACH(std::string snet, mapMultiArgs["-onlynet"]) {
|
BOOST_FOREACH(const std::string& snet, mapMultiArgs["-onlynet"]) {
|
||||||
enum Network net = ParseNetwork(snet);
|
enum Network net = ParseNetwork(snet);
|
||||||
if (net == NET_UNROUTABLE)
|
if (net == NET_UNROUTABLE)
|
||||||
return InitError(strprintf(_("Unknown network specified in -onlynet: '%s'"), snet));
|
return InitError(strprintf(_("Unknown network specified in -onlynet: '%s'"), snet));
|
||||||
@@ -1170,13 +1170,13 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
bool fBound = false;
|
bool fBound = false;
|
||||||
if (fListen) {
|
if (fListen) {
|
||||||
if (mapArgs.count("-bind") || mapArgs.count("-whitebind")) {
|
if (mapArgs.count("-bind") || mapArgs.count("-whitebind")) {
|
||||||
BOOST_FOREACH(std::string strBind, mapMultiArgs["-bind"]) {
|
BOOST_FOREACH(const std::string& strBind, mapMultiArgs["-bind"]) {
|
||||||
CService addrBind;
|
CService addrBind;
|
||||||
if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false))
|
if (!Lookup(strBind.c_str(), addrBind, GetListenPort(), false))
|
||||||
return InitError(strprintf(_("Cannot resolve -bind address: '%s'"), strBind));
|
return InitError(strprintf(_("Cannot resolve -bind address: '%s'"), strBind));
|
||||||
fBound |= Bind(addrBind, (BF_EXPLICIT | BF_REPORT_ERROR));
|
fBound |= Bind(addrBind, (BF_EXPLICIT | BF_REPORT_ERROR));
|
||||||
}
|
}
|
||||||
BOOST_FOREACH(std::string strBind, mapMultiArgs["-whitebind"]) {
|
BOOST_FOREACH(const std::string& strBind, mapMultiArgs["-whitebind"]) {
|
||||||
CService addrBind;
|
CService addrBind;
|
||||||
if (!Lookup(strBind.c_str(), addrBind, 0, false))
|
if (!Lookup(strBind.c_str(), addrBind, 0, false))
|
||||||
return InitError(strprintf(_("Cannot resolve -whitebind address: '%s'"), strBind));
|
return InitError(strprintf(_("Cannot resolve -whitebind address: '%s'"), strBind));
|
||||||
@@ -1196,7 +1196,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mapArgs.count("-externalip")) {
|
if (mapArgs.count("-externalip")) {
|
||||||
BOOST_FOREACH(string strAddr, mapMultiArgs["-externalip"]) {
|
BOOST_FOREACH(const std::string& strAddr, mapMultiArgs["-externalip"]) {
|
||||||
CService addrLocal(strAddr, GetListenPort(), fNameLookup);
|
CService addrLocal(strAddr, GetListenPort(), fNameLookup);
|
||||||
if (!addrLocal.IsValid())
|
if (!addrLocal.IsValid())
|
||||||
return InitError(strprintf(_("Cannot resolve -externalip address: '%s'"), strAddr));
|
return InitError(strprintf(_("Cannot resolve -externalip address: '%s'"), strAddr));
|
||||||
@@ -1204,7 +1204,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(string strDest, mapMultiArgs["-seednode"])
|
BOOST_FOREACH(const std::string& strDest, mapMultiArgs["-seednode"])
|
||||||
AddOneShot(strDest);
|
AddOneShot(strDest);
|
||||||
|
|
||||||
#if ENABLE_ZMQ
|
#if ENABLE_ZMQ
|
||||||
@@ -1572,7 +1572,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
std::vector<boost::filesystem::path> vImportFiles;
|
std::vector<boost::filesystem::path> vImportFiles;
|
||||||
if (mapArgs.count("-loadblock"))
|
if (mapArgs.count("-loadblock"))
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(string strFile, mapMultiArgs["-loadblock"])
|
BOOST_FOREACH(const std::string& strFile, mapMultiArgs["-loadblock"])
|
||||||
vImportFiles.push_back(strFile);
|
vImportFiles.push_back(strFile);
|
||||||
}
|
}
|
||||||
threadGroup.create_thread(boost::bind(&ThreadImport, vImportFiles));
|
threadGroup.create_thread(boost::bind(&ThreadImport, vImportFiles));
|
||||||
|
|||||||
@@ -4072,7 +4072,7 @@ void static CheckBlockIndex()
|
|||||||
// CAlert
|
// CAlert
|
||||||
//
|
//
|
||||||
|
|
||||||
string GetWarnings(string strFor)
|
std::string GetWarnings(const std::string& strFor)
|
||||||
{
|
{
|
||||||
int nPriority = 0;
|
int nPriority = 0;
|
||||||
string strStatusBar;
|
string strStatusBar;
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ void PartitionCheck(bool (*initialDownloadCheck)(), CCriticalSection& cs, const
|
|||||||
/** Check whether we are doing an initial block download (synchronizing from disk or network) */
|
/** Check whether we are doing an initial block download (synchronizing from disk or network) */
|
||||||
bool IsInitialBlockDownload();
|
bool IsInitialBlockDownload();
|
||||||
/** Format a string that describes several potential problems detected by the core */
|
/** Format a string that describes several potential problems detected by the core */
|
||||||
std::string GetWarnings(std::string strFor);
|
std::string GetWarnings(const std::string& strFor);
|
||||||
/** Retrieve a transaction (from memory pool, or from disk, if possible) */
|
/** Retrieve a transaction (from memory pool, or from disk, if possible) */
|
||||||
bool GetTransaction(const uint256 &hash, CTransaction &tx, uint256 &hashBlock, bool fAllowSlow = false);
|
bool GetTransaction(const uint256 &hash, CTransaction &tx, uint256 &hashBlock, bool fAllowSlow = false);
|
||||||
/** Find the best known block, and make it the tip of the block chain */
|
/** Find the best known block, and make it the tip of the block chain */
|
||||||
|
|||||||
21
src/net.cpp
21
src/net.cpp
@@ -107,7 +107,7 @@ boost::condition_variable messageHandlerCondition;
|
|||||||
static CNodeSignals g_signals;
|
static CNodeSignals g_signals;
|
||||||
CNodeSignals& GetNodeSignals() { return g_signals; }
|
CNodeSignals& GetNodeSignals() { return g_signals; }
|
||||||
|
|
||||||
void AddOneShot(string strDest)
|
void AddOneShot(const std::string& strDest)
|
||||||
{
|
{
|
||||||
LOCK(cs_vOneShots);
|
LOCK(cs_vOneShots);
|
||||||
vOneShots.push_back(strDest);
|
vOneShots.push_back(strDest);
|
||||||
@@ -1316,7 +1316,7 @@ void ThreadDNSAddressSeed()
|
|||||||
vector<CAddress> vAdd;
|
vector<CAddress> vAdd;
|
||||||
if (LookupHost(seed.host.c_str(), vIPs))
|
if (LookupHost(seed.host.c_str(), vIPs))
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(CNetAddr& ip, vIPs)
|
BOOST_FOREACH(const CNetAddr& ip, vIPs)
|
||||||
{
|
{
|
||||||
int nOneDay = 24*3600;
|
int nOneDay = 24*3600;
|
||||||
CAddress addr = CAddress(CService(ip, Params().GetDefaultPort()));
|
CAddress addr = CAddress(CService(ip, Params().GetDefaultPort()));
|
||||||
@@ -1380,7 +1380,7 @@ void ThreadOpenConnections()
|
|||||||
for (int64_t nLoop = 0;; nLoop++)
|
for (int64_t nLoop = 0;; nLoop++)
|
||||||
{
|
{
|
||||||
ProcessOneShot();
|
ProcessOneShot();
|
||||||
BOOST_FOREACH(string strAddr, mapMultiArgs["-connect"])
|
BOOST_FOREACH(const std::string& strAddr, mapMultiArgs["-connect"])
|
||||||
{
|
{
|
||||||
CAddress addr;
|
CAddress addr;
|
||||||
OpenNetworkConnection(addr, NULL, strAddr.c_str());
|
OpenNetworkConnection(addr, NULL, strAddr.c_str());
|
||||||
@@ -1483,10 +1483,10 @@ void ThreadOpenAddedConnections()
|
|||||||
list<string> lAddresses(0);
|
list<string> lAddresses(0);
|
||||||
{
|
{
|
||||||
LOCK(cs_vAddedNodes);
|
LOCK(cs_vAddedNodes);
|
||||||
BOOST_FOREACH(string& strAddNode, vAddedNodes)
|
BOOST_FOREACH(const std::string& strAddNode, vAddedNodes)
|
||||||
lAddresses.push_back(strAddNode);
|
lAddresses.push_back(strAddNode);
|
||||||
}
|
}
|
||||||
BOOST_FOREACH(string& strAddNode, lAddresses) {
|
BOOST_FOREACH(const std::string& strAddNode, lAddresses) {
|
||||||
CAddress addr;
|
CAddress addr;
|
||||||
CSemaphoreGrant grant(*semOutbound);
|
CSemaphoreGrant grant(*semOutbound);
|
||||||
OpenNetworkConnection(addr, &grant, strAddNode.c_str());
|
OpenNetworkConnection(addr, &grant, strAddNode.c_str());
|
||||||
@@ -1501,20 +1501,19 @@ void ThreadOpenAddedConnections()
|
|||||||
list<string> lAddresses(0);
|
list<string> lAddresses(0);
|
||||||
{
|
{
|
||||||
LOCK(cs_vAddedNodes);
|
LOCK(cs_vAddedNodes);
|
||||||
BOOST_FOREACH(string& strAddNode, vAddedNodes)
|
BOOST_FOREACH(const std::string& strAddNode, vAddedNodes)
|
||||||
lAddresses.push_back(strAddNode);
|
lAddresses.push_back(strAddNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
list<vector<CService> > lservAddressesToAdd(0);
|
list<vector<CService> > lservAddressesToAdd(0);
|
||||||
BOOST_FOREACH(string& strAddNode, lAddresses)
|
BOOST_FOREACH(const std::string& strAddNode, lAddresses) {
|
||||||
{
|
|
||||||
vector<CService> vservNode(0);
|
vector<CService> vservNode(0);
|
||||||
if(Lookup(strAddNode.c_str(), vservNode, Params().GetDefaultPort(), fNameLookup, 0))
|
if(Lookup(strAddNode.c_str(), vservNode, Params().GetDefaultPort(), fNameLookup, 0))
|
||||||
{
|
{
|
||||||
lservAddressesToAdd.push_back(vservNode);
|
lservAddressesToAdd.push_back(vservNode);
|
||||||
{
|
{
|
||||||
LOCK(cs_setservAddNodeAddresses);
|
LOCK(cs_setservAddNodeAddresses);
|
||||||
BOOST_FOREACH(CService& serv, vservNode)
|
BOOST_FOREACH(const CService& serv, vservNode)
|
||||||
setservAddNodeAddresses.insert(serv);
|
setservAddNodeAddresses.insert(serv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1525,7 +1524,7 @@ void ThreadOpenAddedConnections()
|
|||||||
LOCK(cs_vNodes);
|
LOCK(cs_vNodes);
|
||||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||||
for (list<vector<CService> >::iterator it = lservAddressesToAdd.begin(); it != lservAddressesToAdd.end(); it++)
|
for (list<vector<CService> >::iterator it = lservAddressesToAdd.begin(); it != lservAddressesToAdd.end(); it++)
|
||||||
BOOST_FOREACH(CService& addrNode, *(it))
|
BOOST_FOREACH(const CService& addrNode, *(it))
|
||||||
if (pnode->addr == addrNode)
|
if (pnode->addr == addrNode)
|
||||||
{
|
{
|
||||||
it = lservAddressesToAdd.erase(it);
|
it = lservAddressesToAdd.erase(it);
|
||||||
@@ -2110,7 +2109,7 @@ bool CAddrDB::Read(CAddrMan& addr)
|
|||||||
unsigned int ReceiveFloodSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); }
|
unsigned int ReceiveFloodSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); }
|
||||||
unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 1*1000); }
|
unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 1*1000); }
|
||||||
|
|
||||||
CNode::CNode(SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn, bool fInboundIn) :
|
CNode::CNode(SOCKET hSocketIn, const CAddress& addrIn, const std::string& addrNameIn, bool fInboundIn) :
|
||||||
ssSend(SER_NETWORK, INIT_PROTO_VERSION),
|
ssSend(SER_NETWORK, INIT_PROTO_VERSION),
|
||||||
addrKnown(5000, 0.001),
|
addrKnown(5000, 0.001),
|
||||||
setInventoryKnown(SendBufferSize() / 1000)
|
setInventoryKnown(SendBufferSize() / 1000)
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ static const size_t SETASKFOR_MAX_SZ = 2 * MAX_INV_SZ;
|
|||||||
unsigned int ReceiveFloodSize();
|
unsigned int ReceiveFloodSize();
|
||||||
unsigned int SendBufferSize();
|
unsigned int SendBufferSize();
|
||||||
|
|
||||||
void AddOneShot(std::string strDest);
|
void AddOneShot(const std::string& strDest);
|
||||||
void AddressCurrentlyConnected(const CService& addr);
|
void AddressCurrentlyConnected(const CService& addr);
|
||||||
CNode* FindNode(const CNetAddr& ip);
|
CNode* FindNode(const CNetAddr& ip);
|
||||||
CNode* FindNode(const std::string& addrName);
|
CNode* FindNode(const std::string& addrName);
|
||||||
@@ -328,7 +328,7 @@ public:
|
|||||||
// Whether a ping is requested.
|
// Whether a ping is requested.
|
||||||
bool fPingQueued;
|
bool fPingQueued;
|
||||||
|
|
||||||
CNode(SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn = "", bool fInboundIn=false);
|
CNode(SOCKET hSocketIn, const CAddress &addrIn, const std::string &addrNameIn = "", bool fInboundIn = false);
|
||||||
~CNode();
|
~CNode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -651,8 +651,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
|
|||||||
UniValue transactions(UniValue::VARR);
|
UniValue transactions(UniValue::VARR);
|
||||||
map<uint256, int64_t> setTxIndex;
|
map<uint256, int64_t> setTxIndex;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
BOOST_FOREACH (CTransaction& tx, pblock->vtx)
|
BOOST_FOREACH (const CTransaction& tx, pblock->vtx) {
|
||||||
{
|
|
||||||
uint256 txHash = tx.GetHash();
|
uint256 txHash = tx.GetHash();
|
||||||
setTxIndex[txHash] = i++;
|
setTxIndex[txHash] = i++;
|
||||||
|
|
||||||
|
|||||||
@@ -253,19 +253,20 @@ UniValue getaddednodeinfo(const UniValue& params, bool fHelp)
|
|||||||
if (params.size() == 1)
|
if (params.size() == 1)
|
||||||
{
|
{
|
||||||
LOCK(cs_vAddedNodes);
|
LOCK(cs_vAddedNodes);
|
||||||
BOOST_FOREACH(string& strAddNode, vAddedNodes)
|
BOOST_FOREACH(const std::string& strAddNode, vAddedNodes)
|
||||||
laddedNodes.push_back(strAddNode);
|
laddedNodes.push_back(strAddNode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string strNode = params[1].get_str();
|
string strNode = params[1].get_str();
|
||||||
LOCK(cs_vAddedNodes);
|
LOCK(cs_vAddedNodes);
|
||||||
BOOST_FOREACH(string& strAddNode, vAddedNodes)
|
BOOST_FOREACH(const std::string& strAddNode, vAddedNodes) {
|
||||||
if (strAddNode == strNode)
|
if (strAddNode == strNode)
|
||||||
{
|
{
|
||||||
laddedNodes.push_back(strAddNode);
|
laddedNodes.push_back(strAddNode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (laddedNodes.size() == 0)
|
if (laddedNodes.size() == 0)
|
||||||
throw JSONRPCError(RPC_CLIENT_NODE_NOT_ADDED, "Error: Node has not been added.");
|
throw JSONRPCError(RPC_CLIENT_NODE_NOT_ADDED, "Error: Node has not been added.");
|
||||||
}
|
}
|
||||||
@@ -273,8 +274,7 @@ UniValue getaddednodeinfo(const UniValue& params, bool fHelp)
|
|||||||
UniValue ret(UniValue::VARR);
|
UniValue ret(UniValue::VARR);
|
||||||
if (!fDns)
|
if (!fDns)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(string& strAddNode, laddedNodes)
|
BOOST_FOREACH (const std::string& strAddNode, laddedNodes) {
|
||||||
{
|
|
||||||
UniValue obj(UniValue::VOBJ);
|
UniValue obj(UniValue::VOBJ);
|
||||||
obj.push_back(Pair("addednode", strAddNode));
|
obj.push_back(Pair("addednode", strAddNode));
|
||||||
ret.push_back(obj);
|
ret.push_back(obj);
|
||||||
@@ -283,8 +283,7 @@ UniValue getaddednodeinfo(const UniValue& params, bool fHelp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
list<pair<string, vector<CService> > > laddedAddreses(0);
|
list<pair<string, vector<CService> > > laddedAddreses(0);
|
||||||
BOOST_FOREACH(string& strAddNode, laddedNodes)
|
BOOST_FOREACH(const std::string& strAddNode, laddedNodes) {
|
||||||
{
|
|
||||||
vector<CService> vservNode(0);
|
vector<CService> vservNode(0);
|
||||||
if(Lookup(strAddNode.c_str(), vservNode, Params().GetDefaultPort(), fNameLookup, 0))
|
if(Lookup(strAddNode.c_str(), vservNode, Params().GetDefaultPort(), fNameLookup, 0))
|
||||||
laddedAddreses.push_back(make_pair(strAddNode, vservNode));
|
laddedAddreses.push_back(make_pair(strAddNode, vservNode));
|
||||||
@@ -306,12 +305,11 @@ UniValue getaddednodeinfo(const UniValue& params, bool fHelp)
|
|||||||
|
|
||||||
UniValue addresses(UniValue::VARR);
|
UniValue addresses(UniValue::VARR);
|
||||||
bool fConnected = false;
|
bool fConnected = false;
|
||||||
BOOST_FOREACH(CService& addrNode, it->second)
|
BOOST_FOREACH(const CService& addrNode, it->second) {
|
||||||
{
|
|
||||||
bool fFound = false;
|
bool fFound = false;
|
||||||
UniValue node(UniValue::VOBJ);
|
UniValue node(UniValue::VOBJ);
|
||||||
node.push_back(Pair("address", addrNode.ToString()));
|
node.push_back(Pair("address", addrNode.ToString()));
|
||||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
BOOST_FOREACH(CNode* pnode, vNodes) {
|
||||||
if (pnode->addr == addrNode)
|
if (pnode->addr == addrNode)
|
||||||
{
|
{
|
||||||
fFound = true;
|
fFound = true;
|
||||||
@@ -319,6 +317,7 @@ UniValue getaddednodeinfo(const UniValue& params, bool fHelp)
|
|||||||
node.push_back(Pair("connected", pnode->fInbound ? "inbound" : "outbound"));
|
node.push_back(Pair("connected", pnode->fInbound ? "inbound" : "outbound"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!fFound)
|
if (!fFound)
|
||||||
node.push_back(Pair("connected", "false"));
|
node.push_back(Pair("connected", "false"));
|
||||||
addresses.push_back(node);
|
addresses.push_back(node);
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ vector<unsigned char> ParseHexO(const UniValue& o, string strKey)
|
|||||||
* Note: This interface may still be subject to change.
|
* Note: This interface may still be subject to change.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
string CRPCTable::help(string strCommand) const
|
std::string CRPCTable::help(const std::string& strCommand) const
|
||||||
{
|
{
|
||||||
string strRet;
|
string strRet;
|
||||||
string category;
|
string category;
|
||||||
@@ -419,7 +419,7 @@ CRPCTable::CRPCTable()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const CRPCCommand *CRPCTable::operator[](string name) const
|
const CRPCCommand *CRPCTable::operator[](const std::string& name) const
|
||||||
{
|
{
|
||||||
map<string, const CRPCCommand*>::const_iterator it = mapCommands.find(name);
|
map<string, const CRPCCommand*>::const_iterator it = mapCommands.find(name);
|
||||||
if (it == mapCommands.end())
|
if (it == mapCommands.end())
|
||||||
@@ -1071,11 +1071,13 @@ UniValue CRPCTable::execute(const std::string &strMethod, const UniValue ¶ms
|
|||||||
g_rpcSignals.PostCommand(*pcmd);
|
g_rpcSignals.PostCommand(*pcmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string HelpExampleCli(string methodname, string args){
|
std::string HelpExampleCli(const std::string& methodname, const std::string& args)
|
||||||
|
{
|
||||||
return "> zcash-cli " + methodname + " " + args + "\n";
|
return "> zcash-cli " + methodname + " " + args + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string HelpExampleRpc(string methodname, string args){
|
std::string HelpExampleRpc(const std::string& methodname, const std::string& args)
|
||||||
|
{
|
||||||
return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", "
|
return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", "
|
||||||
"\"method\": \"" + methodname + "\", \"params\": [" + args + "] }' -H 'content-type: text/plain;' http://127.0.0.1:8232/\n";
|
"\"method\": \"" + methodname + "\", \"params\": [" + args + "] }' -H 'content-type: text/plain;' http://127.0.0.1:8232/\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,8 +116,8 @@ private:
|
|||||||
std::map<std::string, const CRPCCommand*> mapCommands;
|
std::map<std::string, const CRPCCommand*> mapCommands;
|
||||||
public:
|
public:
|
||||||
CRPCTable();
|
CRPCTable();
|
||||||
const CRPCCommand* operator[](std::string name) const;
|
const CRPCCommand* operator[](const std::string& name) const;
|
||||||
std::string help(std::string name) const;
|
std::string help(const std::string& name) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a method.
|
* Execute a method.
|
||||||
@@ -149,8 +149,8 @@ extern UniValue ValueFromAmount(const CAmount& amount);
|
|||||||
extern double GetDifficulty(const CBlockIndex* blockindex = NULL);
|
extern double GetDifficulty(const CBlockIndex* blockindex = NULL);
|
||||||
extern double GetNetworkDifficulty(const CBlockIndex* blockindex = NULL);
|
extern double GetNetworkDifficulty(const CBlockIndex* blockindex = NULL);
|
||||||
extern std::string HelpRequiringPassphrase();
|
extern std::string HelpRequiringPassphrase();
|
||||||
extern std::string HelpExampleCli(std::string methodname, std::string args);
|
extern std::string HelpExampleCli(const std::string& methodname, const std::string& args);
|
||||||
extern std::string HelpExampleRpc(std::string methodname, std::string args);
|
extern std::string HelpExampleRpc(const std::string& methodname, const std::string& args);
|
||||||
|
|
||||||
extern void EnsureWalletIsUnlocked();
|
extern void EnsureWalletIsUnlocked();
|
||||||
|
|
||||||
|
|||||||
@@ -770,7 +770,7 @@ boost::filesystem::path GetTempPath() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void runCommand(std::string strCommand)
|
void runCommand(const std::string& strCommand)
|
||||||
{
|
{
|
||||||
int nErr = ::system(strCommand.c_str());
|
int nErr = ::system(strCommand.c_str());
|
||||||
if (nErr)
|
if (nErr)
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ boost::filesystem::path GetSpecialFolderPath(int nFolder, bool fCreate = true);
|
|||||||
#endif
|
#endif
|
||||||
boost::filesystem::path GetTempPath();
|
boost::filesystem::path GetTempPath();
|
||||||
void ShrinkDebugFile();
|
void ShrinkDebugFile();
|
||||||
void runCommand(std::string strCommand);
|
void runCommand(const std::string& strCommand);
|
||||||
const boost::filesystem::path GetExportDir();
|
const boost::filesystem::path GetExportDir();
|
||||||
|
|
||||||
/** Returns licensing information (for -version) */
|
/** Returns licensing information (for -version) */
|
||||||
|
|||||||
@@ -488,7 +488,7 @@ bool ParseDouble(const std::string& str, double *out)
|
|||||||
return text.eof() && !text.fail();
|
return text.eof() && !text.fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string FormatParagraph(const std::string in, size_t width, size_t indent)
|
std::string FormatParagraph(const std::string& in, size_t width, size_t indent)
|
||||||
{
|
{
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
size_t col = 0;
|
size_t col = 0;
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ inline std::string HexStr(const T& vch, bool fSpaces=false)
|
|||||||
* Format a paragraph of text to a fixed width, adding spaces for
|
* Format a paragraph of text to a fixed width, adding spaces for
|
||||||
* indentation to any added line.
|
* indentation to any added line.
|
||||||
*/
|
*/
|
||||||
std::string FormatParagraph(const std::string in, size_t width=79, size_t indent=0);
|
std::string FormatParagraph(const std::string& in, size_t width = 79, size_t indent = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timing-attack-resistant comparison.
|
* Timing-attack-resistant comparison.
|
||||||
|
|||||||
@@ -3148,7 +3148,7 @@ set< set<CTxDestination> > CWallet::GetAddressGroupings()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
set<CTxDestination> CWallet::GetAccountAddresses(string strAccount) const
|
std::set<CTxDestination> CWallet::GetAccountAddresses(const std::string& strAccount) const
|
||||||
{
|
{
|
||||||
LOCK(cs_wallet);
|
LOCK(cs_wallet);
|
||||||
set<CTxDestination> result;
|
set<CTxDestination> result;
|
||||||
|
|||||||
@@ -708,7 +708,7 @@ public:
|
|||||||
SetNull();
|
SetNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
CWallet(std::string strWalletFileIn)
|
CWallet(const std::string& strWalletFileIn)
|
||||||
{
|
{
|
||||||
SetNull();
|
SetNull();
|
||||||
|
|
||||||
@@ -931,7 +931,7 @@ public:
|
|||||||
std::set< std::set<CTxDestination> > GetAddressGroupings();
|
std::set< std::set<CTxDestination> > GetAddressGroupings();
|
||||||
std::map<CTxDestination, CAmount> GetAddressBalances();
|
std::map<CTxDestination, CAmount> GetAddressBalances();
|
||||||
|
|
||||||
std::set<CTxDestination> GetAccountAddresses(std::string strAccount) const;
|
std::set<CTxDestination> GetAccountAddresses(const std::string& strAccount) const;
|
||||||
|
|
||||||
boost::optional<uint256> GetNoteNullifier(
|
boost::optional<uint256> GetNoteNullifier(
|
||||||
const JSDescription& jsdesc,
|
const JSDescription& jsdesc,
|
||||||
|
|||||||
Reference in New Issue
Block a user