Skip to content

Commit 78040f9

Browse files
committed
[net processing] Rename nStartingHeight to m_starting_height
Not done as a scripted diff to avoid misnaming the local variable in ProcessMessage().
1 parent 77a2c2f commit 78040f9

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

src/net.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ class CNodeStats
705705
bool m_manual_connection;
706706
bool m_bip152_highbandwidth_to;
707707
bool m_bip152_highbandwidth_from;
708-
int nStartingHeight;
708+
int m_starting_height;
709709
uint64_t nSendBytes;
710710
mapMsgCmdSize mapSendBytesPerMsgCmd;
711711
uint64_t nRecvBytes;

src/net_processing.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ bool PeerManager::GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) {
875875
PeerRef peer = GetPeerRef(nodeid);
876876
if (peer == nullptr) return false;
877877
stats.m_misbehavior_score = WITH_LOCK(peer->m_misbehavior_mutex, return peer->m_misbehavior_score);
878-
stats.nStartingHeight = peer->nStartingHeight;
878+
stats.m_starting_height = peer->m_starting_height;
879879

880880
return true;
881881
}
@@ -1863,7 +1863,7 @@ void PeerManager::ProcessHeadersMessage(CNode& pfrom, const Peer& peer,
18631863
// TODO: optimize: if pindexLast is an ancestor of ::ChainActive().Tip or pindexBestHeader, continue
18641864
// from there instead.
18651865
LogPrint(BCLog::NET, "more getheaders (%d) to end to peer=%d (startheight:%d)\n",
1866-
pindexLast->nHeight, pfrom.GetId(), peer.nStartingHeight);
1866+
pindexLast->nHeight, pfrom.GetId(), peer.m_starting_height);
18671867
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::GETHEADERS, ::ChainActive().GetLocator(pindexLast), uint256()));
18681868
}
18691869

@@ -2289,7 +2289,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
22892289
ServiceFlags nServices;
22902290
int nVersion;
22912291
std::string cleanSubVer;
2292-
int nStartingHeight = -1;
2292+
int starting_height = -1;
22932293
bool fRelay = true;
22942294

22952295
vRecv >> nVersion >> nServiceInt >> nTime >> addrMe;
@@ -2320,7 +2320,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
23202320
cleanSubVer = SanitizeString(strSubVer);
23212321
}
23222322
if (!vRecv.empty()) {
2323-
vRecv >> nStartingHeight;
2323+
vRecv >> starting_height;
23242324
}
23252325
if (!vRecv.empty())
23262326
vRecv >> fRelay;
@@ -2369,7 +2369,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
23692369
LOCK(pfrom.cs_SubVer);
23702370
pfrom.cleanSubVer = cleanSubVer;
23712371
}
2372-
peer->nStartingHeight = nStartingHeight;
2372+
peer->m_starting_height = starting_height;
23732373

23742374
// set nodes not relaying blocks and tx and not serving (parts) of the historical blockchain as "clients"
23752375
pfrom.fClient = (!(nServices & NODE_NETWORK) && !(nServices & NODE_NETWORK_LIMITED));
@@ -2449,7 +2449,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
24492449

24502450
LogPrint(BCLog::NET, "receive version message: %s: version %d, blocks=%d, us=%s, peer=%d%s\n",
24512451
cleanSubVer, pfrom.nVersion,
2452-
peer->nStartingHeight, addrMe.ToString(), pfrom.GetId(),
2452+
peer->m_starting_height, addrMe.ToString(), pfrom.GetId(),
24532453
remoteAddr);
24542454

24552455
int64_t nTimeOffset = nTime - GetTime();
@@ -2483,7 +2483,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
24832483

24842484
if (!pfrom.IsInboundConn()) {
24852485
LogPrintf("New outbound peer connected: version: %d, blocks=%d, peer=%d%s (%s)\n",
2486-
pfrom.nVersion.load(), peer->nStartingHeight,
2486+
pfrom.nVersion.load(), peer->m_starting_height,
24872487
pfrom.GetId(), (fLogIPs ? strprintf(", peeraddr=%s", pfrom.addr.ToString()) : ""),
24882488
pfrom.ConnectionTypeAsString());
24892489
}
@@ -4202,7 +4202,7 @@ bool PeerManager::SendMessages(CNode* pto)
42024202
got back an empty response. */
42034203
if (pindexStart->pprev)
42044204
pindexStart = pindexStart->pprev;
4205-
LogPrint(BCLog::NET, "initial getheaders (%d) to peer=%d (startheight:%d)\n", pindexStart->nHeight, pto->GetId(), peer->nStartingHeight);
4205+
LogPrint(BCLog::NET, "initial getheaders (%d) to peer=%d (startheight:%d)\n", pindexStart->nHeight, pto->GetId(), peer->m_starting_height);
42064206
m_connman.PushMessage(pto, msgMaker.Make(NetMsgType::GETHEADERS, ::ChainActive().GetLocator(pindexStart), uint256()));
42074207
}
42084208
}

src/net_processing.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct CNodeStateStats {
3636
int m_misbehavior_score = 0;
3737
int nSyncHeight = -1;
3838
int nCommonHeight = -1;
39-
int nStartingHeight = -1;
39+
int m_starting_height = -1;
4040
std::vector<int> vHeightInFlight;
4141
};
4242

@@ -64,7 +64,7 @@ struct Peer {
6464
bool m_should_discourage GUARDED_BY(m_misbehavior_mutex){false};
6565

6666
/** This peer's reported block height when we connected */
67-
std::atomic<int> nStartingHeight{-1};
67+
std::atomic<int> m_starting_height{-1};
6868

6969
/** Set of txids to reconsider once their parent transactions have been accepted **/
7070
std::set<uint256> m_orphan_work_set GUARDED_BY(g_cs_orphans);

src/qt/rpcconsole.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ void RPCConsole::updateDetailWidget()
11351135
else
11361136
ui->peerCommonHeight->setText(tr("Unknown"));
11371137

1138-
ui->peerHeight->setText(QString::number(stats->nodeStateStats.nStartingHeight));
1138+
ui->peerHeight->setText(QString::number(stats->nodeStateStats.m_starting_height));
11391139
}
11401140

11411141
ui->detailWidget->show();

src/rpc/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ static RPCHelpMan getpeerinfo()
229229
// banscore is deprecated in v0.21 for removal in v0.22
230230
obj.pushKV("banscore", statestats.m_misbehavior_score);
231231
}
232-
obj.pushKV("startingheight", statestats.nStartingHeight);
232+
obj.pushKV("startingheight", statestats.m_starting_height);
233233
obj.pushKV("synced_headers", statestats.nSyncHeight);
234234
obj.pushKV("synced_blocks", statestats.nCommonHeight);
235235
UniValue heights(UniValue::VARR);

0 commit comments

Comments
 (0)