mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
refactor: Rename local variable nSendVersion
This commit is contained in:
parent
e9a6d8b13b
commit
8d2026796a
1 changed files with 9 additions and 10 deletions
|
@ -2350,13 +2350,11 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
|||
uint64_t nServiceInt;
|
||||
ServiceFlags nServices;
|
||||
int nVersion;
|
||||
int nSendVersion;
|
||||
std::string cleanSubVer;
|
||||
int nStartingHeight = -1;
|
||||
bool fRelay = true;
|
||||
|
||||
vRecv >> nVersion >> nServiceInt >> nTime >> addrMe;
|
||||
nSendVersion = std::min(nVersion, PROTOCOL_VERSION);
|
||||
nServices = ServiceFlags(nServiceInt);
|
||||
if (!pfrom.IsInboundConn())
|
||||
{
|
||||
|
@ -2405,11 +2403,16 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
|||
if (pfrom.IsInboundConn())
|
||||
PushNodeVersion(pfrom, m_connman, GetAdjustedTime());
|
||||
|
||||
// Change version
|
||||
const int greatest_common_version = std::min(nVersion, PROTOCOL_VERSION);
|
||||
pfrom.SetCommonVersion(greatest_common_version);
|
||||
pfrom.nVersion = nVersion;
|
||||
|
||||
if (nVersion >= WTXID_RELAY_VERSION) {
|
||||
m_connman.PushMessage(&pfrom, CNetMsgMaker(nSendVersion).Make(NetMsgType::WTXIDRELAY));
|
||||
m_connman.PushMessage(&pfrom, CNetMsgMaker(greatest_common_version).Make(NetMsgType::WTXIDRELAY));
|
||||
}
|
||||
|
||||
m_connman.PushMessage(&pfrom, CNetMsgMaker(nSendVersion).Make(NetMsgType::VERACK));
|
||||
m_connman.PushMessage(&pfrom, CNetMsgMaker(greatest_common_version).Make(NetMsgType::VERACK));
|
||||
|
||||
pfrom.nServices = nServices;
|
||||
pfrom.SetAddrLocal(addrMe);
|
||||
|
@ -2430,10 +2433,6 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
|||
pfrom.m_tx_relay->fRelayTxes = fRelay; // set to true after we get the first filter* message
|
||||
}
|
||||
|
||||
// Change version
|
||||
pfrom.SetCommonVersion(nSendVersion);
|
||||
pfrom.nVersion = nVersion;
|
||||
|
||||
if((nServices & NODE_WITNESS))
|
||||
{
|
||||
LOCK(cs_main);
|
||||
|
@ -2479,7 +2478,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
|||
}
|
||||
|
||||
// Get recent addresses
|
||||
m_connman.PushMessage(&pfrom, CNetMsgMaker(nSendVersion).Make(NetMsgType::GETADDR));
|
||||
m_connman.PushMessage(&pfrom, CNetMsgMaker(greatest_common_version).Make(NetMsgType::GETADDR));
|
||||
pfrom.fGetAddr = true;
|
||||
|
||||
// Moves address from New to Tried table in Addrman, resolves
|
||||
|
@ -2503,7 +2502,7 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
|
|||
// If the peer is old enough to have the old alert system, send it the final alert.
|
||||
if (pfrom.nVersion <= 70012) {
|
||||
CDataStream finalAlert(ParseHex("60010000000000000000000000ffffff7f00000000ffffff7ffeffff7f01ffffff7f00000000ffffff7f00ffffff7f002f555247454e543a20416c657274206b657920636f6d70726f6d697365642c2075706772616465207265717569726564004630440220653febd6410f470f6bae11cad19c48413becb1ac2c17f908fd0fd53bdc3abd5202206d0e9c96fe88d4a0f01ed9dedae2b6f9e00da94cad0fecaae66ecf689bf71b50"), SER_NETWORK, PROTOCOL_VERSION);
|
||||
m_connman.PushMessage(&pfrom, CNetMsgMaker(nSendVersion).Make("alert", finalAlert));
|
||||
m_connman.PushMessage(&pfrom, CNetMsgMaker(greatest_common_version).Make("alert", finalAlert));
|
||||
}
|
||||
|
||||
// Feeler connections exist only to verify if address is online.
|
||||
|
|
Loading…
Add table
Reference in a new issue