Make p2pdebug messages default to off
This commit is contained in:
25
src/main.cpp
25
src/main.cpp
@@ -1457,7 +1457,6 @@ bool CheckTransactionWithoutProofVerification(uint32_t tiptime,const CTransactio
|
|||||||
if (iscoinbase == 0 && txout.nValue > 0)
|
if (iscoinbase == 0 && txout.nValue > 0)
|
||||||
{
|
{
|
||||||
// TODO: if we are upgraded to Sapling, we can allow Sprout sourced funds to sit in a transparent address
|
// TODO: if we are upgraded to Sapling, we can allow Sprout sourced funds to sit in a transparent address
|
||||||
//
|
|
||||||
char destaddr[65];
|
char destaddr[65];
|
||||||
Getscriptaddress(destaddr,txout.scriptPubKey);
|
Getscriptaddress(destaddr,txout.scriptPubKey);
|
||||||
if ( hush_isnotaryvout(destaddr,tiptime) == 0 )
|
if ( hush_isnotaryvout(destaddr,tiptime) == 0 )
|
||||||
@@ -6777,15 +6776,18 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
LogPrintf("dropmessagestest DROPPING RECV MESSAGE\n");
|
LogPrintf("dropmessagestest DROPPING RECV MESSAGE\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
auto p2pdebug = GetArg("-p2pdebug",0);
|
||||||
|
|
||||||
fprintf(stderr,"%s: netmsg: %s from %s\n", __func__, strCommand.c_str(), pfrom->addr.ToString().c_str() );
|
if(p2pdebug)
|
||||||
|
fprintf(stderr,"%s: netmsg: %s from %s\n", __func__, strCommand.c_str(), pfrom->addr.ToString().c_str() );
|
||||||
|
|
||||||
if (strCommand == "version") {
|
if (strCommand == "version") {
|
||||||
// Feeler connections exist only to verify if node is online
|
// Feeler connections exist only to verify if node is online
|
||||||
if (pfrom->fFeeler) {
|
if (pfrom->fFeeler) {
|
||||||
assert(pfrom->fInbound == false);
|
assert(pfrom->fInbound == false);
|
||||||
pfrom->fDisconnect = true;
|
pfrom->fDisconnect = true;
|
||||||
fprintf(stderr,"%s: disconnecting feelerconn from %s\n", __func__, pfrom->addr.ToString().c_str() );
|
if(p2pdebug)
|
||||||
|
fprintf(stderr,"%s: disconnecting feelerconn from %s\n", __func__, pfrom->addr.ToString().c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Each connection can only send one version message
|
// Each connection can only send one version message
|
||||||
@@ -6962,7 +6964,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
} else if (strCommand == "addr") {
|
} else if (strCommand == "addr") {
|
||||||
vector<CAddress> vAddr;
|
vector<CAddress> vAddr;
|
||||||
vRecv >> vAddr;
|
vRecv >> vAddr;
|
||||||
fprintf(stderr,"%s: processing add with vAddr.size=%lu\n", __func__, vAddr.size() );
|
if(p2pdebug)
|
||||||
|
fprintf(stderr,"%s: processing add with vAddr.size=%lu\n", __func__, vAddr.size() );
|
||||||
|
|
||||||
// Don't want addr from older versions unless seeding
|
// Don't want addr from older versions unless seeding
|
||||||
if (pfrom->nVersion < CADDR_TIME_VERSION && addrman.size() > 1000)
|
if (pfrom->nVersion < CADDR_TIME_VERSION && addrman.size() > 1000)
|
||||||
@@ -6980,7 +6983,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
BOOST_FOREACH(CAddress& addr, vAddr)
|
BOOST_FOREACH(CAddress& addr, vAddr)
|
||||||
{
|
{
|
||||||
boost::this_thread::interruption_point();
|
boost::this_thread::interruption_point();
|
||||||
fprintf(stderr,"%s: %s.nTime=%d\n", __func__, addr.ToString().c_str(), addr.nTime);
|
if(p2pdebug)
|
||||||
|
fprintf(stderr,"%s: %s.nTime=%d\n", __func__, addr.ToString().c_str(), addr.nTime);
|
||||||
|
|
||||||
if (addr.nTime <= 100000000 || addr.nTime > nNow + 10 * 60)
|
if (addr.nTime <= 100000000 || addr.nTime > nNow + 10 * 60)
|
||||||
addr.nTime = nNow - 5 * 24 * 60 * 60;
|
addr.nTime = nNow - 5 * 24 * 60 * 60;
|
||||||
@@ -7019,7 +7023,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
if (fReachable) {
|
if (fReachable) {
|
||||||
vAddrOk.push_back(addr);
|
vAddrOk.push_back(addr);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr,"%s: %s with nTime=%d is not reachable\n",__func__,addr.ToString().c_str(), addr.nTime);
|
if(p2pdebug)
|
||||||
|
fprintf(stderr,"%s: %s with nTime=%d is not reachable\n",__func__,addr.ToString().c_str(), addr.nTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
addrman.Add(vAddrOk, pfrom->addr, 2 * 60 * 60);
|
addrman.Add(vAddrOk, pfrom->addr, 2 * 60 * 60);
|
||||||
@@ -7141,7 +7146,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
else if (strCommand == "inv") {
|
else if (strCommand == "inv") {
|
||||||
vector<CInv> vInv;
|
vector<CInv> vInv;
|
||||||
vRecv >> vInv;
|
vRecv >> vInv;
|
||||||
fprintf(stderr,"%s: processing inv with vInv.size=%lu\n", __func__, vInv.size() );
|
if(p2pdebug)
|
||||||
|
fprintf(stderr,"%s: processing inv with vInv.size=%lu\n", __func__, vInv.size() );
|
||||||
if (vInv.size() > MAX_INV_SZ)
|
if (vInv.size() > MAX_INV_SZ)
|
||||||
{
|
{
|
||||||
Misbehaving(pfrom->GetId(), 20);
|
Misbehaving(pfrom->GetId(), 20);
|
||||||
@@ -7203,7 +7209,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
} else if (strCommand == "getdata") {
|
} else if (strCommand == "getdata") {
|
||||||
vector<CInv> vInv;
|
vector<CInv> vInv;
|
||||||
vRecv >> vInv;
|
vRecv >> vInv;
|
||||||
fprintf(stderr,"%s: getdata vInv.size=%lu\n", __func__, vInv.size() );
|
if(p2pdebug)
|
||||||
|
fprintf(stderr,"%s: getdata vInv.size=%lu\n", __func__, vInv.size() );
|
||||||
if (vInv.size() > MAX_INV_SZ)
|
if (vInv.size() > MAX_INV_SZ)
|
||||||
{
|
{
|
||||||
Misbehaving(pfrom->GetId(), 20);
|
Misbehaving(pfrom->GetId(), 20);
|
||||||
@@ -7534,7 +7541,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
|
|
||||||
} else if (strCommand == "mempool") {
|
} else if (strCommand == "mempool") {
|
||||||
LOCK2(cs_main, pfrom->cs_filter);
|
LOCK2(cs_main, pfrom->cs_filter);
|
||||||
fprintf(stderr,"%s: mempool\n",__func__);
|
//LogPrintf("%s: mempool request from %s",__func__, pfrom->addr.ToString().c_str());
|
||||||
// TODO: limit mempool requests per time and per peer
|
// TODO: limit mempool requests per time and per peer
|
||||||
|
|
||||||
std::vector<uint256> vtxid;
|
std::vector<uint256> vtxid;
|
||||||
|
|||||||
Reference in New Issue
Block a user