Skip to content

Commit

Permalink
Disallowed debug network functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
mike31 committed Jun 4, 2018
1 parent ecb3046 commit 4fa4b6d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/protocol/relay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ int MultichainCollectChunks(mc_ChunkCollector* collector)
collect_row->m_State.m_Status |= MC_CCF_UPDATED;
for(int k=0;k<2;k++)collector->m_StatTotal[k].m_Unresponded+=k ? collect_row->m_ChunkDef.m_Size : 1;
}
if((collect_row->m_State.m_QueryNextAttempt <= time_now) && (total_in_queries < max_total_in_queries) && (query_count<collector->m_MaxMemPoolSize))
if((collect_row->m_State.m_QueryNextAttempt <= time_now) && (total_in_queries < max_total_in_queries) && ((int)query_count<collector->m_MaxMemPoolSize))
{
if( (collect_row->m_State.m_Status & MC_CCF_ERROR_MASK) == 0)
{
Expand Down Expand Up @@ -1846,10 +1846,10 @@ bool mc_RelayManager::ProcessRelay( CNode* pfrom,
switch(msg_type_in)
{
case MC_RMT_MC_ADDRESS_QUERY:
verify_flags |= MC_VRA_IS_NOT_RESPONSE;
verify_flags |= MC_VRA_IS_NOT_RESPONSE | MC_VRA_NOT_ALLOWED;
break;
case MC_RMT_NODE_DETAILS:
verify_flags |= MC_VRA_IS_RESPONSE | MC_VRA_SIGNATURE_ORIGIN;
verify_flags |= MC_VRA_IS_RESPONSE | MC_VRA_SIGNATURE_ORIGIN | MC_VRA_NOT_ALLOWED;
break;
case MC_RMT_CHUNK_QUERY:
verify_flags |= MC_VRA_IS_NOT_RESPONSE;
Expand All @@ -1866,12 +1866,18 @@ bool mc_RelayManager::ProcessRelay( CNode* pfrom,
default:
if(verify_flags & MC_VRA_MESSAGE_TYPE)
{
LogPrintf("ProcessOffchain() : Unsupported relay message type %s\n",mc_MsgTypeStr(msg_type_in).c_str());
LogPrintf("ProcessOffchain() : Unsupported offchain message type %s\n",mc_MsgTypeStr(msg_type_in).c_str());
return false;
}
break;
}

if(verify_flags & MC_VRA_NOT_ALLOWED)
{
LogPrintf("ProcessOffchain() : Not allowed offchain message type %s\n",mc_MsgTypeStr(msg_type_in).c_str());
return false;
}

if(verify_flags & MC_VRA_SINGLE_HOP)
{
if(hop_count)
Expand Down
1 change: 1 addition & 0 deletions src/protocol/relay.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#define MC_VRA_BROADCAST_ONCE 0x00800000
#define MC_VRA_SINGLE_HOP_BROADCAST 0x01000000
#define MC_VRA_TIMESTAMP 0x02000000
#define MC_VRA_NOT_ALLOWED 0x80000000

#define MC_VRA_DEFAULT 0x03970000

Expand Down
2 changes: 2 additions & 0 deletions src/rpc/rpcdebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,10 @@ Value debug(const Array& params, bool fHelp)
}

request_id=pRelayManager->SendRequest(pto,request_type,0,payload);
/*
printf("%s",request_str.c_str());
printf(". Request ID: %s\n",request_id.ToString().c_str());
*/
}

uint32_t time_now;
Expand Down

0 comments on commit 4fa4b6d

Please sign in to comment.