mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Show nodeid instead of addresses (for anonymity) unless otherwise requested.
This commit is contained in:
parent
f04f123407
commit
2e36866fec
@ -288,6 +288,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||||||
strUsage += " -gen " + _("Generate coins (default: 0)") + "\n";
|
strUsage += " -gen " + _("Generate coins (default: 0)") + "\n";
|
||||||
strUsage += " -genproclimit=<n> " + _("Set the processor limit for when generation is on (-1 = unlimited, default: -1)") + "\n";
|
strUsage += " -genproclimit=<n> " + _("Set the processor limit for when generation is on (-1 = unlimited, default: -1)") + "\n";
|
||||||
strUsage += " -help-debug " + _("Show all debugging options (usage: --help -help-debug)") + "\n";
|
strUsage += " -help-debug " + _("Show all debugging options (usage: --help -help-debug)") + "\n";
|
||||||
|
strUsage += " -logips " + _("Include IP addresses in debug output (default: 0)") + "\n";
|
||||||
strUsage += " -logtimestamps " + _("Prepend debug output with timestamp (default: 1)") + "\n";
|
strUsage += " -logtimestamps " + _("Prepend debug output with timestamp (default: 1)") + "\n";
|
||||||
if (GetBoolArg("-help-debug", false))
|
if (GetBoolArg("-help-debug", false))
|
||||||
{
|
{
|
||||||
@ -585,6 +586,7 @@ bool AppInit2(boost::thread_group& threadGroup)
|
|||||||
fServer = GetBoolArg("-server", false);
|
fServer = GetBoolArg("-server", false);
|
||||||
fPrintToConsole = GetBoolArg("-printtoconsole", false);
|
fPrintToConsole = GetBoolArg("-printtoconsole", false);
|
||||||
fLogTimestamps = GetBoolArg("-logtimestamps", true);
|
fLogTimestamps = GetBoolArg("-logtimestamps", true);
|
||||||
|
fLogIPs = GetBoolArg("-logips", false);
|
||||||
setvbuf(stdout, NULL, _IOLBF, 0);
|
setvbuf(stdout, NULL, _IOLBF, 0);
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
bool fDisableWallet = GetBoolArg("-disablewallet", false);
|
bool fDisableWallet = GetBoolArg("-disablewallet", false);
|
||||||
|
34
src/main.cpp
34
src/main.cpp
@ -3547,7 +3547,7 @@ void static ProcessGetData(CNode* pfrom)
|
|||||||
bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||||
{
|
{
|
||||||
RandAddSeedPerfmon();
|
RandAddSeedPerfmon();
|
||||||
LogPrint("net", "received: %s (%u bytes)\n", strCommand, vRecv.size());
|
LogPrint("net", "received: %s (%u bytes) peer=%d\n", strCommand, vRecv.size(), pfrom->id);
|
||||||
if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0)
|
if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0)
|
||||||
{
|
{
|
||||||
LogPrintf("dropmessagestest DROPPING RECV MESSAGE\n");
|
LogPrintf("dropmessagestest DROPPING RECV MESSAGE\n");
|
||||||
@ -3579,7 +3579,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
if (pfrom->nVersion < MIN_PEER_PROTO_VERSION)
|
if (pfrom->nVersion < MIN_PEER_PROTO_VERSION)
|
||||||
{
|
{
|
||||||
// disconnect from peers older than this proto version
|
// disconnect from peers older than this proto version
|
||||||
LogPrintf("partner %s using obsolete version %i; disconnecting\n", pfrom->addr.ToString(), pfrom->nVersion);
|
LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, pfrom->nVersion);
|
||||||
pfrom->PushMessage("reject", strCommand, REJECT_OBSOLETE,
|
pfrom->PushMessage("reject", strCommand, REJECT_OBSOLETE,
|
||||||
strprintf("Version must be %d or greater", MIN_PEER_PROTO_VERSION));
|
strprintf("Version must be %d or greater", MIN_PEER_PROTO_VERSION));
|
||||||
pfrom->fDisconnect = true;
|
pfrom->fDisconnect = true;
|
||||||
@ -3660,7 +3660,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
|
|
||||||
pfrom->fSuccessfullyConnected = true;
|
pfrom->fSuccessfullyConnected = true;
|
||||||
|
|
||||||
LogPrintf("receive version message: %s: version %d, blocks=%d, us=%s, them=%s, peer=%s\n", pfrom->cleanSubVer, pfrom->nVersion, pfrom->nStartingHeight, addrMe.ToString(), addrFrom.ToString(), pfrom->addr.ToString());
|
LogPrintf("receive version message: %s: version %d, blocks=%d, us=%s, peer=%d\n", pfrom->cleanSubVer, pfrom->nVersion, pfrom->nStartingHeight, addrMe.ToString(), pfrom->id);
|
||||||
|
|
||||||
AddTimeData(pfrom->addr, nTime);
|
AddTimeData(pfrom->addr, nTime);
|
||||||
}
|
}
|
||||||
@ -3767,7 +3767,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
pfrom->AddInventoryKnown(inv);
|
pfrom->AddInventoryKnown(inv);
|
||||||
|
|
||||||
bool fAlreadyHave = AlreadyHave(inv);
|
bool fAlreadyHave = AlreadyHave(inv);
|
||||||
LogPrint("net", " got inventory: %s %s\n", inv.ToString(), fAlreadyHave ? "have" : "new");
|
LogPrint("net", "got inv: %s %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom->id);
|
||||||
|
|
||||||
if (!fAlreadyHave) {
|
if (!fAlreadyHave) {
|
||||||
if (!fImporting && !fReindex) {
|
if (!fImporting && !fReindex) {
|
||||||
@ -3800,10 +3800,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fDebug || (vInv.size() != 1))
|
if (fDebug || (vInv.size() != 1))
|
||||||
LogPrint("net", "received getdata (%u invsz)\n", vInv.size());
|
LogPrint("net", "received getdata (%u invsz) peer=%d\n", vInv.size(), pfrom->id);
|
||||||
|
|
||||||
if ((fDebug && vInv.size() > 0) || (vInv.size() == 1))
|
if ((fDebug && vInv.size() > 0) || (vInv.size() == 1))
|
||||||
LogPrint("net", "received getdata for: %s\n", vInv[0].ToString());
|
LogPrint("net", "received getdata for: %s peer=%d\n", vInv[0].ToString(), pfrom->id);
|
||||||
|
|
||||||
pfrom->vRecvGetData.insert(pfrom->vRecvGetData.end(), vInv.begin(), vInv.end());
|
pfrom->vRecvGetData.insert(pfrom->vRecvGetData.end(), vInv.begin(), vInv.end());
|
||||||
ProcessGetData(pfrom);
|
ProcessGetData(pfrom);
|
||||||
@ -3825,7 +3825,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
if (pindex)
|
if (pindex)
|
||||||
pindex = chainActive.Next(pindex);
|
pindex = chainActive.Next(pindex);
|
||||||
int nLimit = 500;
|
int nLimit = 500;
|
||||||
LogPrint("net", "getblocks %d to %s limit %d\n", (pindex ? pindex->nHeight : -1), hashStop==uint256(0) ? "end" : hashStop.ToString(), nLimit);
|
LogPrint("net", "getblocks %d to %s limit %d from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop==uint256(0) ? "end" : hashStop.ToString(), nLimit, pfrom->id);
|
||||||
for (; pindex; pindex = chainActive.Next(pindex))
|
for (; pindex; pindex = chainActive.Next(pindex))
|
||||||
{
|
{
|
||||||
if (pindex->GetBlockHash() == hashStop)
|
if (pindex->GetBlockHash() == hashStop)
|
||||||
@ -3908,8 +3908,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
vEraseQueue.push_back(inv.hash);
|
vEraseQueue.push_back(inv.hash);
|
||||||
|
|
||||||
|
|
||||||
LogPrint("mempool", "AcceptToMemoryPool: %s %s : accepted %s (poolsz %u)\n",
|
LogPrint("mempool", "AcceptToMemoryPool: peer=%d %s : accepted %s (poolsz %u)\n",
|
||||||
pfrom->addr.ToString(), pfrom->cleanSubVer,
|
pfrom->id, pfrom->cleanSubVer,
|
||||||
tx.GetHash().ToString(),
|
tx.GetHash().ToString(),
|
||||||
mempool.mapTx.size());
|
mempool.mapTx.size());
|
||||||
|
|
||||||
@ -3962,8 +3962,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
int nDoS = 0;
|
int nDoS = 0;
|
||||||
if (state.IsInvalid(nDoS))
|
if (state.IsInvalid(nDoS))
|
||||||
{
|
{
|
||||||
LogPrint("mempool", "%s from %s %s was not accepted into the memory pool: %s\n", tx.GetHash().ToString(),
|
LogPrint("mempool", "%s from peer=%d %s was not accepted into the memory pool: %s\n", tx.GetHash().ToString(),
|
||||||
pfrom->addr.ToString(), pfrom->cleanSubVer,
|
pfrom->id, pfrom->cleanSubVer,
|
||||||
state.GetRejectReason());
|
state.GetRejectReason());
|
||||||
pfrom->PushMessage("reject", strCommand, state.GetRejectCode(),
|
pfrom->PushMessage("reject", strCommand, state.GetRejectCode(),
|
||||||
state.GetRejectReason(), inv.hash);
|
state.GetRejectReason(), inv.hash);
|
||||||
@ -3978,7 +3978,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
CBlock block;
|
CBlock block;
|
||||||
vRecv >> block;
|
vRecv >> block;
|
||||||
|
|
||||||
LogPrint("net", "received block %s\n", block.GetHash().ToString());
|
LogPrint("net", "received block %s peer=%d\n", block.GetHash().ToString(), pfrom->id);
|
||||||
// block.print();
|
// block.print();
|
||||||
|
|
||||||
CInv inv(MSG_BLOCK, block.GetHash());
|
CInv inv(MSG_BLOCK, block.GetHash());
|
||||||
@ -4095,8 +4095,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(sProblem.empty())) {
|
if (!(sProblem.empty())) {
|
||||||
LogPrint("net", "pong %s %s: %s, %x expected, %x received, %u bytes\n",
|
LogPrint("net", "pong peer=%d %s: %s, %x expected, %x received, %u bytes\n",
|
||||||
pfrom->addr.ToString(),
|
pfrom->id,
|
||||||
pfrom->cleanSubVer,
|
pfrom->cleanSubVer,
|
||||||
sProblem,
|
sProblem,
|
||||||
pfrom->nPingNonceSent,
|
pfrom->nPingNonceSent,
|
||||||
@ -4336,7 +4336,7 @@ bool ProcessMessages(CNode* pfrom)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!fRet)
|
if (!fRet)
|
||||||
LogPrintf("ProcessMessage(%s, %u bytes) FAILED\n", strCommand, nMessageSize);
|
LogPrintf("ProcessMessage(%s, %u bytes) FAILED peer=%d\n", strCommand, nMessageSize, pfrom->id);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -4540,7 +4540,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
|
|||||||
uint256 hash = state.vBlocksToDownload.front();
|
uint256 hash = state.vBlocksToDownload.front();
|
||||||
vGetData.push_back(CInv(MSG_BLOCK, hash));
|
vGetData.push_back(CInv(MSG_BLOCK, hash));
|
||||||
MarkBlockAsInFlight(pto->GetId(), hash);
|
MarkBlockAsInFlight(pto->GetId(), hash);
|
||||||
LogPrint("net", "Requesting block %s from %s\n", hash.ToString(), state.name);
|
LogPrint("net", "Requesting block %s peer=%d\n", hash.ToString(), pto->id);
|
||||||
if (vGetData.size() >= 1000)
|
if (vGetData.size() >= 1000)
|
||||||
{
|
{
|
||||||
pto->PushMessage("getdata", vGetData);
|
pto->PushMessage("getdata", vGetData);
|
||||||
@ -4557,7 +4557,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
|
|||||||
if (!AlreadyHave(inv))
|
if (!AlreadyHave(inv))
|
||||||
{
|
{
|
||||||
if (fDebug)
|
if (fDebug)
|
||||||
LogPrint("net", "sending getdata: %s\n", inv.ToString());
|
LogPrint("net", "Requesting %s peer=%d\n", inv.ToString(), pto->id);
|
||||||
vGetData.push_back(inv);
|
vGetData.push_back(inv);
|
||||||
if (vGetData.size() >= 1000)
|
if (vGetData.size() >= 1000)
|
||||||
{
|
{
|
||||||
|
13
src/net.cpp
13
src/net.cpp
@ -491,8 +491,6 @@ CNode* ConnectNode(CAddress addrConnect, const char *pszDest)
|
|||||||
{
|
{
|
||||||
addrman.Attempt(addrConnect);
|
addrman.Attempt(addrConnect);
|
||||||
|
|
||||||
LogPrint("net", "connected %s\n", pszDest ? pszDest : addrConnect.ToString());
|
|
||||||
|
|
||||||
// Set to non-blocking
|
// Set to non-blocking
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
u_long nOne = 1;
|
u_long nOne = 1;
|
||||||
@ -513,6 +511,7 @@ CNode* ConnectNode(CAddress addrConnect, const char *pszDest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pnode->nTimeConnected = GetTime();
|
pnode->nTimeConnected = GetTime();
|
||||||
|
|
||||||
return pnode;
|
return pnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -524,7 +523,7 @@ void CNode::CloseSocketDisconnect()
|
|||||||
fDisconnect = true;
|
fDisconnect = true;
|
||||||
if (hSocket != INVALID_SOCKET)
|
if (hSocket != INVALID_SOCKET)
|
||||||
{
|
{
|
||||||
LogPrint("net", "disconnecting node %s\n", addrName);
|
LogPrint("net", "disconnecting peer=%d\n", id);
|
||||||
closesocket(hSocket);
|
closesocket(hSocket);
|
||||||
hSocket = INVALID_SOCKET;
|
hSocket = INVALID_SOCKET;
|
||||||
}
|
}
|
||||||
@ -548,7 +547,10 @@ void CNode::PushVersion()
|
|||||||
CAddress addrYou = (addr.IsRoutable() && !IsProxy(addr) ? addr : CAddress(CService("0.0.0.0",0)));
|
CAddress addrYou = (addr.IsRoutable() && !IsProxy(addr) ? addr : CAddress(CService("0.0.0.0",0)));
|
||||||
CAddress addrMe = GetLocalAddress(&addr);
|
CAddress addrMe = GetLocalAddress(&addr);
|
||||||
RAND_bytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce));
|
RAND_bytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce));
|
||||||
LogPrint("net", "send version message: version %d, blocks=%d, us=%s, them=%s, peer=%s\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString(), addrYou.ToString(), addr.ToString());
|
if (fLogIPs)
|
||||||
|
LogPrint("net", "send version message: version %d, blocks=%d, us=%s, them=%s, peer=%d\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString(), addrYou.ToString(), id);
|
||||||
|
else
|
||||||
|
LogPrint("net", "send version message: version %d, blocks=%d, us=%s, peer=%d\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString(), id);
|
||||||
PushMessage("version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe,
|
PushMessage("version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe,
|
||||||
nLocalHostNonce, FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, std::vector<string>()), nBestHeight, true);
|
nLocalHostNonce, FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, std::vector<string>()), nBestHeight, true);
|
||||||
}
|
}
|
||||||
@ -950,7 +952,6 @@ void ThreadSocketHandler()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogPrint("net", "accepted connection %s\n", addr.ToString());
|
|
||||||
CNode* pnode = new CNode(hSocket, addr, "", true);
|
CNode* pnode = new CNode(hSocket, addr, "", true);
|
||||||
pnode->AddRef();
|
pnode->AddRef();
|
||||||
|
|
||||||
@ -1040,7 +1041,7 @@ void ThreadSocketHandler()
|
|||||||
{
|
{
|
||||||
if (pnode->nLastRecv == 0 || pnode->nLastSend == 0)
|
if (pnode->nLastRecv == 0 || pnode->nLastSend == 0)
|
||||||
{
|
{
|
||||||
LogPrint("net", "socket no message in first 60 seconds, %d %d\n", pnode->nLastRecv != 0, pnode->nLastSend != 0);
|
LogPrint("net", "socket no message in first 60 seconds, %d %d from %d\n", pnode->nLastRecv != 0, pnode->nLastSend != 0, pnode->id);
|
||||||
pnode->fDisconnect = true;
|
pnode->fDisconnect = true;
|
||||||
}
|
}
|
||||||
else if (nTime - pnode->nLastSend > TIMEOUT_INTERVAL)
|
else if (nTime - pnode->nLastSend > TIMEOUT_INTERVAL)
|
||||||
|
@ -330,6 +330,11 @@ public:
|
|||||||
id = nLastNodeId++;
|
id = nLastNodeId++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fLogIPs)
|
||||||
|
LogPrint("net", "Added connection to %s peer=%d\n", addrName, id);
|
||||||
|
else
|
||||||
|
LogPrint("net", "Added connection peer=%d\n", id);
|
||||||
|
|
||||||
// Be shy and don't send version until we hear
|
// Be shy and don't send version until we hear
|
||||||
if (hSocket != INVALID_SOCKET && !fInbound)
|
if (hSocket != INVALID_SOCKET && !fInbound)
|
||||||
PushVersion();
|
PushVersion();
|
||||||
@ -446,7 +451,7 @@ public:
|
|||||||
nRequestTime = it->second;
|
nRequestTime = it->second;
|
||||||
else
|
else
|
||||||
nRequestTime = 0;
|
nRequestTime = 0;
|
||||||
LogPrint("net", "askfor %s %d (%s)\n", inv.ToString(), nRequestTime, DateTimeStrFormat("%H:%M:%S", nRequestTime/1000000).c_str());
|
LogPrint("net", "askfor %s %d (%s) peer=%d\n", inv.ToString(), nRequestTime, DateTimeStrFormat("%H:%M:%S", nRequestTime/1000000).c_str(), id);
|
||||||
|
|
||||||
// Make sure not to reuse time indexes to keep things in the same order
|
// Make sure not to reuse time indexes to keep things in the same order
|
||||||
int64_t nNow = GetTimeMicros() - 1000000;
|
int64_t nNow = GetTimeMicros() - 1000000;
|
||||||
@ -514,7 +519,7 @@ public:
|
|||||||
assert(ssSend.size () >= CMessageHeader::CHECKSUM_OFFSET + sizeof(nChecksum));
|
assert(ssSend.size () >= CMessageHeader::CHECKSUM_OFFSET + sizeof(nChecksum));
|
||||||
memcpy((char*)&ssSend[CMessageHeader::CHECKSUM_OFFSET], &nChecksum, sizeof(nChecksum));
|
memcpy((char*)&ssSend[CMessageHeader::CHECKSUM_OFFSET], &nChecksum, sizeof(nChecksum));
|
||||||
|
|
||||||
LogPrint("net", "(%d bytes)\n", nSize);
|
LogPrint("net", "(%d bytes) peer=%d\n", nSize, id);
|
||||||
|
|
||||||
std::deque<CSerializeData>::iterator it = vSendMsg.insert(vSendMsg.end(), CSerializeData());
|
std::deque<CSerializeData>::iterator it = vSendMsg.insert(vSendMsg.end(), CSerializeData());
|
||||||
ssSend.GetAndClear(*it);
|
ssSend.GetAndClear(*it);
|
||||||
|
@ -95,6 +95,7 @@ bool fDaemon = false;
|
|||||||
bool fServer = false;
|
bool fServer = false;
|
||||||
string strMiscWarning;
|
string strMiscWarning;
|
||||||
bool fLogTimestamps = false;
|
bool fLogTimestamps = false;
|
||||||
|
bool fLogIPs = false;
|
||||||
volatile bool fReopenDebugLog = false;
|
volatile bool fReopenDebugLog = false;
|
||||||
CClientUIInterface uiInterface;
|
CClientUIInterface uiInterface;
|
||||||
|
|
||||||
|
@ -100,6 +100,7 @@ extern bool fPrintToDebugLog;
|
|||||||
extern bool fServer;
|
extern bool fServer;
|
||||||
extern std::string strMiscWarning;
|
extern std::string strMiscWarning;
|
||||||
extern bool fLogTimestamps;
|
extern bool fLogTimestamps;
|
||||||
|
extern bool fLogIPs;
|
||||||
extern volatile bool fReopenDebugLog;
|
extern volatile bool fReopenDebugLog;
|
||||||
|
|
||||||
void RandAddSeed();
|
void RandAddSeed();
|
||||||
|
Loading…
Reference in New Issue
Block a user