mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-04 21:04:58 +02:00
Merge #10189: devtools/net: add a verifier for scriptable changes. Use it to make CNode::id private.
0f3471fnet: make CNode's id private (Cory Fields)9ff0a51scripted-diff: net: Use accessor rather than node's id directly (Cory Fields)e50c33edevtools: add script to verify scriptable changes (Cory Fields) Tree-SHA512: a0ff50f4e1d38a2b63109b4996546c91b3e02e00d92c0bf04f48792948f78b1f6d9227a15d25c823fd4723a0277fc6a32c2c1287c7abbb7e50fd82ffb0f8d994
This commit is contained in:
14
src/net.cpp
14
src/net.cpp
@@ -948,7 +948,7 @@ bool CConnman::AttemptToEvictConnection()
|
||||
continue;
|
||||
if (node->fDisconnect)
|
||||
continue;
|
||||
NodeEvictionCandidate candidate = {node->id, node->nTimeConnected, node->nMinPingUsecTime,
|
||||
NodeEvictionCandidate candidate = {node->GetId(), node->nTimeConnected, node->nMinPingUsecTime,
|
||||
node->nLastBlockTime, node->nLastTXTime,
|
||||
(node->nServices & nRelevantServices) == nRelevantServices,
|
||||
node->fRelayTxes, node->pfilter != NULL, node->addr, node->nKeyedNetGroup};
|
||||
@@ -1374,7 +1374,7 @@ void CConnman::ThreadSocketHandler()
|
||||
{
|
||||
if (pnode->nLastRecv == 0 || pnode->nLastSend == 0)
|
||||
{
|
||||
LogPrint(BCLog::NET, "socket no message in first 60 seconds, %d %d from %d\n", pnode->nLastRecv != 0, pnode->nLastSend != 0, pnode->id);
|
||||
LogPrint(BCLog::NET, "socket no message in first 60 seconds, %d %d from %d\n", pnode->nLastRecv != 0, pnode->nLastSend != 0, pnode->GetId());
|
||||
pnode->fDisconnect = true;
|
||||
}
|
||||
else if (nTime - pnode->nLastSend > TIMEOUT_INTERVAL)
|
||||
@@ -1394,7 +1394,7 @@ void CConnman::ThreadSocketHandler()
|
||||
}
|
||||
else if (!pnode->fSuccessfullyConnected)
|
||||
{
|
||||
LogPrintf("version handshake timeout from %d\n", pnode->id);
|
||||
LogPrintf("version handshake timeout from %d\n", pnode->GetId());
|
||||
pnode->fDisconnect = true;
|
||||
}
|
||||
}
|
||||
@@ -2487,7 +2487,7 @@ bool CConnman::DisconnectNode(NodeId id)
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
for(CNode* pnode : vNodes) {
|
||||
if (id == pnode->id) {
|
||||
if (id == pnode->GetId()) {
|
||||
pnode->fDisconnect = true;
|
||||
return true;
|
||||
}
|
||||
@@ -2625,10 +2625,10 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
|
||||
nTimeConnected(GetSystemTimeInSeconds()),
|
||||
addr(addrIn),
|
||||
fInbound(fInboundIn),
|
||||
id(idIn),
|
||||
nKeyedNetGroup(nKeyedNetGroupIn),
|
||||
addrKnown(5000, 0.001),
|
||||
filterInventoryKnown(50000, 0.000001),
|
||||
id(idIn),
|
||||
nLocalHostNonce(nLocalHostNonceIn),
|
||||
nLocalServices(nLocalServicesIn),
|
||||
nMyStartingHeight(nMyStartingHeightIn),
|
||||
@@ -2744,7 +2744,7 @@ void CConnman::PushMessage(CNode* pnode, CSerializedNetMsg&& msg)
|
||||
{
|
||||
size_t nMessageSize = msg.data.size();
|
||||
size_t nTotalSize = nMessageSize + CMessageHeader::HEADER_SIZE;
|
||||
LogPrint(BCLog::NET, "sending %s (%d bytes) peer=%d\n", SanitizeString(msg.command.c_str()), nMessageSize, pnode->id);
|
||||
LogPrint(BCLog::NET, "sending %s (%d bytes) peer=%d\n", SanitizeString(msg.command.c_str()), nMessageSize, pnode->GetId());
|
||||
|
||||
std::vector<unsigned char> serializedHeader;
|
||||
serializedHeader.reserve(CMessageHeader::HEADER_SIZE);
|
||||
@@ -2782,7 +2782,7 @@ bool CConnman::ForNode(NodeId id, std::function<bool(CNode* pnode)> func)
|
||||
CNode* found = nullptr;
|
||||
LOCK(cs_vNodes);
|
||||
for (auto&& pnode : vNodes) {
|
||||
if(pnode->id == id) {
|
||||
if(pnode->GetId() == id) {
|
||||
found = pnode;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user