mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-19 21:13:08 +02:00
[net processing] Rename nStartingHeight to m_starting_height
Not done as a scripted diff to avoid misnaming the local variable in ProcessMessage().
This commit is contained in:
@ -705,7 +705,7 @@ public:
|
|||||||
bool m_manual_connection;
|
bool m_manual_connection;
|
||||||
bool m_bip152_highbandwidth_to;
|
bool m_bip152_highbandwidth_to;
|
||||||
bool m_bip152_highbandwidth_from;
|
bool m_bip152_highbandwidth_from;
|
||||||
int nStartingHeight;
|
int m_starting_height;
|
||||||
uint64_t nSendBytes;
|
uint64_t nSendBytes;
|
||||||
mapMsgCmdSize mapSendBytesPerMsgCmd;
|
mapMsgCmdSize mapSendBytesPerMsgCmd;
|
||||||
uint64_t nRecvBytes;
|
uint64_t nRecvBytes;
|
||||||
|
@ -875,7 +875,7 @@ bool PeerManager::GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) {
|
|||||||
PeerRef peer = GetPeerRef(nodeid);
|
PeerRef peer = GetPeerRef(nodeid);
|
||||||
if (peer == nullptr) return false;
|
if (peer == nullptr) return false;
|
||||||
stats.m_misbehavior_score = WITH_LOCK(peer->m_misbehavior_mutex, return peer->m_misbehavior_score);
|
stats.m_misbehavior_score = WITH_LOCK(peer->m_misbehavior_mutex, return peer->m_misbehavior_score);
|
||||||
stats.nStartingHeight = peer->nStartingHeight;
|
stats.m_starting_height = peer->m_starting_height;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1863,7 +1863,7 @@ void PeerManager::ProcessHeadersMessage(CNode& pfrom, const Peer& peer,
|
|||||||
// TODO: optimize: if pindexLast is an ancestor of ::ChainActive().Tip or pindexBestHeader, continue
|
// TODO: optimize: if pindexLast is an ancestor of ::ChainActive().Tip or pindexBestHeader, continue
|
||||||
// from there instead.
|
// from there instead.
|
||||||
LogPrint(BCLog::NET, "more getheaders (%d) to end to peer=%d (startheight:%d)\n",
|
LogPrint(BCLog::NET, "more getheaders (%d) to end to peer=%d (startheight:%d)\n",
|
||||||
pindexLast->nHeight, pfrom.GetId(), peer.nStartingHeight);
|
pindexLast->nHeight, pfrom.GetId(), peer.m_starting_height);
|
||||||
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::GETHEADERS, ::ChainActive().GetLocator(pindexLast), uint256()));
|
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::GETHEADERS, ::ChainActive().GetLocator(pindexLast), uint256()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2289,7 +2289,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
|||||||
ServiceFlags nServices;
|
ServiceFlags nServices;
|
||||||
int nVersion;
|
int nVersion;
|
||||||
std::string cleanSubVer;
|
std::string cleanSubVer;
|
||||||
int nStartingHeight = -1;
|
int starting_height = -1;
|
||||||
bool fRelay = true;
|
bool fRelay = true;
|
||||||
|
|
||||||
vRecv >> nVersion >> nServiceInt >> nTime >> addrMe;
|
vRecv >> nVersion >> nServiceInt >> nTime >> addrMe;
|
||||||
@ -2320,7 +2320,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
|||||||
cleanSubVer = SanitizeString(strSubVer);
|
cleanSubVer = SanitizeString(strSubVer);
|
||||||
}
|
}
|
||||||
if (!vRecv.empty()) {
|
if (!vRecv.empty()) {
|
||||||
vRecv >> nStartingHeight;
|
vRecv >> starting_height;
|
||||||
}
|
}
|
||||||
if (!vRecv.empty())
|
if (!vRecv.empty())
|
||||||
vRecv >> fRelay;
|
vRecv >> fRelay;
|
||||||
@ -2369,7 +2369,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
|||||||
LOCK(pfrom.cs_SubVer);
|
LOCK(pfrom.cs_SubVer);
|
||||||
pfrom.cleanSubVer = cleanSubVer;
|
pfrom.cleanSubVer = cleanSubVer;
|
||||||
}
|
}
|
||||||
peer->nStartingHeight = nStartingHeight;
|
peer->m_starting_height = starting_height;
|
||||||
|
|
||||||
// set nodes not relaying blocks and tx and not serving (parts) of the historical blockchain as "clients"
|
// set nodes not relaying blocks and tx and not serving (parts) of the historical blockchain as "clients"
|
||||||
pfrom.fClient = (!(nServices & NODE_NETWORK) && !(nServices & NODE_NETWORK_LIMITED));
|
pfrom.fClient = (!(nServices & NODE_NETWORK) && !(nServices & NODE_NETWORK_LIMITED));
|
||||||
@ -2449,7 +2449,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
|||||||
|
|
||||||
LogPrint(BCLog::NET, "receive version message: %s: version %d, blocks=%d, us=%s, peer=%d%s\n",
|
LogPrint(BCLog::NET, "receive version message: %s: version %d, blocks=%d, us=%s, peer=%d%s\n",
|
||||||
cleanSubVer, pfrom.nVersion,
|
cleanSubVer, pfrom.nVersion,
|
||||||
peer->nStartingHeight, addrMe.ToString(), pfrom.GetId(),
|
peer->m_starting_height, addrMe.ToString(), pfrom.GetId(),
|
||||||
remoteAddr);
|
remoteAddr);
|
||||||
|
|
||||||
int64_t nTimeOffset = nTime - GetTime();
|
int64_t nTimeOffset = nTime - GetTime();
|
||||||
@ -2483,7 +2483,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
|||||||
|
|
||||||
if (!pfrom.IsInboundConn()) {
|
if (!pfrom.IsInboundConn()) {
|
||||||
LogPrintf("New outbound peer connected: version: %d, blocks=%d, peer=%d%s (%s)\n",
|
LogPrintf("New outbound peer connected: version: %d, blocks=%d, peer=%d%s (%s)\n",
|
||||||
pfrom.nVersion.load(), peer->nStartingHeight,
|
pfrom.nVersion.load(), peer->m_starting_height,
|
||||||
pfrom.GetId(), (fLogIPs ? strprintf(", peeraddr=%s", pfrom.addr.ToString()) : ""),
|
pfrom.GetId(), (fLogIPs ? strprintf(", peeraddr=%s", pfrom.addr.ToString()) : ""),
|
||||||
pfrom.ConnectionTypeAsString());
|
pfrom.ConnectionTypeAsString());
|
||||||
}
|
}
|
||||||
@ -4202,7 +4202,7 @@ bool PeerManager::SendMessages(CNode* pto)
|
|||||||
got back an empty response. */
|
got back an empty response. */
|
||||||
if (pindexStart->pprev)
|
if (pindexStart->pprev)
|
||||||
pindexStart = pindexStart->pprev;
|
pindexStart = pindexStart->pprev;
|
||||||
LogPrint(BCLog::NET, "initial getheaders (%d) to peer=%d (startheight:%d)\n", pindexStart->nHeight, pto->GetId(), peer->nStartingHeight);
|
LogPrint(BCLog::NET, "initial getheaders (%d) to peer=%d (startheight:%d)\n", pindexStart->nHeight, pto->GetId(), peer->m_starting_height);
|
||||||
m_connman.PushMessage(pto, msgMaker.Make(NetMsgType::GETHEADERS, ::ChainActive().GetLocator(pindexStart), uint256()));
|
m_connman.PushMessage(pto, msgMaker.Make(NetMsgType::GETHEADERS, ::ChainActive().GetLocator(pindexStart), uint256()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ struct CNodeStateStats {
|
|||||||
int m_misbehavior_score = 0;
|
int m_misbehavior_score = 0;
|
||||||
int nSyncHeight = -1;
|
int nSyncHeight = -1;
|
||||||
int nCommonHeight = -1;
|
int nCommonHeight = -1;
|
||||||
int nStartingHeight = -1;
|
int m_starting_height = -1;
|
||||||
std::vector<int> vHeightInFlight;
|
std::vector<int> vHeightInFlight;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ struct Peer {
|
|||||||
bool m_should_discourage GUARDED_BY(m_misbehavior_mutex){false};
|
bool m_should_discourage GUARDED_BY(m_misbehavior_mutex){false};
|
||||||
|
|
||||||
/** This peer's reported block height when we connected */
|
/** This peer's reported block height when we connected */
|
||||||
std::atomic<int> nStartingHeight{-1};
|
std::atomic<int> m_starting_height{-1};
|
||||||
|
|
||||||
/** Set of txids to reconsider once their parent transactions have been accepted **/
|
/** Set of txids to reconsider once their parent transactions have been accepted **/
|
||||||
std::set<uint256> m_orphan_work_set GUARDED_BY(g_cs_orphans);
|
std::set<uint256> m_orphan_work_set GUARDED_BY(g_cs_orphans);
|
||||||
|
@ -1135,7 +1135,7 @@ void RPCConsole::updateDetailWidget()
|
|||||||
else
|
else
|
||||||
ui->peerCommonHeight->setText(tr("Unknown"));
|
ui->peerCommonHeight->setText(tr("Unknown"));
|
||||||
|
|
||||||
ui->peerHeight->setText(QString::number(stats->nodeStateStats.nStartingHeight));
|
ui->peerHeight->setText(QString::number(stats->nodeStateStats.m_starting_height));
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->detailWidget->show();
|
ui->detailWidget->show();
|
||||||
|
@ -229,7 +229,7 @@ static RPCHelpMan getpeerinfo()
|
|||||||
// banscore is deprecated in v0.21 for removal in v0.22
|
// banscore is deprecated in v0.21 for removal in v0.22
|
||||||
obj.pushKV("banscore", statestats.m_misbehavior_score);
|
obj.pushKV("banscore", statestats.m_misbehavior_score);
|
||||||
}
|
}
|
||||||
obj.pushKV("startingheight", statestats.nStartingHeight);
|
obj.pushKV("startingheight", statestats.m_starting_height);
|
||||||
obj.pushKV("synced_headers", statestats.nSyncHeight);
|
obj.pushKV("synced_headers", statestats.nSyncHeight);
|
||||||
obj.pushKV("synced_blocks", statestats.nCommonHeight);
|
obj.pushKV("synced_blocks", statestats.nCommonHeight);
|
||||||
UniValue heights(UniValue::VARR);
|
UniValue heights(UniValue::VARR);
|
||||||
|
Reference in New Issue
Block a user