@@ -393,21 +393,15 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo
393
393
NodeId id = GetNewNodeId ();
394
394
uint64_t nonce = GetDeterministicRandomizer (RANDOMIZER_ID_LOCALHOSTNONCE).Write (id).Finalize ();
395
395
CNode* pnode = new CNode (id, nLocalServices, GetBestHeight (), hSocket, addrConnect, CalculateKeyedNetGroup (addrConnect), nonce, pszDest ? pszDest : " " , false );
396
-
397
-
398
- PushVersion (pnode, GetTime ());
399
-
400
- GetNodeSignals ().InitializeNode (pnode->GetId (), pnode);
396
+ pnode->nServicesExpected = ServiceFlags (addrConnect.nServices & nRelevantServices);
397
+ pnode->nTimeConnected = GetTime ();
401
398
pnode->AddRef ();
402
-
399
+ GetNodeSignals (). InitializeNode (pnode, * this );
403
400
{
404
401
LOCK (cs_vNodes);
405
402
vNodes.push_back (pnode);
406
403
}
407
404
408
- pnode->nServicesExpected = ServiceFlags (addrConnect.nServices & nRelevantServices);
409
- pnode->nTimeConnected = GetTime ();
410
-
411
405
return pnode;
412
406
} else if (!proxyConnectionFailed) {
413
407
// If connecting to the node failed, and failure is not caused by a problem connecting to
@@ -418,24 +412,6 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo
418
412
return NULL ;
419
413
}
420
414
421
- void CConnman::PushVersion (CNode* pnode, int64_t nTime)
422
- {
423
- ServiceFlags nLocalNodeServices = pnode->GetLocalServices ();
424
- CAddress addrYou = (pnode->addr .IsRoutable () && !IsProxy (pnode->addr ) ? pnode->addr : CAddress (CService (), pnode->addr .nServices ));
425
- CAddress addrMe = CAddress (CService (), nLocalNodeServices);
426
- uint64_t nonce = pnode->GetLocalNonce ();
427
- int nNodeStartingHeight = pnode->nMyStartingHeight ;
428
- NodeId id = pnode->GetId ();
429
-
430
- PushMessageWithVersion (pnode, INIT_PROTO_VERSION, NetMsgType::VERSION, PROTOCOL_VERSION, (uint64_t )nLocalNodeServices, nTime, addrYou, addrMe,
431
- nonce, strSubVersion, nNodeStartingHeight, ::fRelayTxes );
432
-
433
- if (fLogIPs )
434
- LogPrint (" net" , " send version message: version %d, blocks=%d, us=%s, them=%s, peer=%d\n " , PROTOCOL_VERSION, nNodeStartingHeight, addrMe.ToString (), addrYou.ToString (), id);
435
- else
436
- LogPrint (" net" , " send version message: version %d, blocks=%d, us=%s, peer=%d\n " , PROTOCOL_VERSION, nNodeStartingHeight, addrMe.ToString (), id);
437
- }
438
-
439
415
void CConnman::DumpBanlist ()
440
416
{
441
417
SweepBanned (); // clean unused entries (if bantime has expired)
@@ -1036,9 +1012,9 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) {
1036
1012
uint64_t nonce = GetDeterministicRandomizer (RANDOMIZER_ID_LOCALHOSTNONCE).Write (id).Finalize ();
1037
1013
1038
1014
CNode* pnode = new CNode (id, nLocalServices, GetBestHeight (), hSocket, addr, CalculateKeyedNetGroup (addr), nonce, " " , true );
1039
- GetNodeSignals ().InitializeNode (pnode->GetId (), pnode);
1040
1015
pnode->AddRef ();
1041
1016
pnode->fWhitelisted = whitelisted;
1017
+ GetNodeSignals ().InitializeNode (pnode, *this );
1042
1018
1043
1019
LogPrint (" net" , " connection from %s accepted\n " , addr.ToString ());
1044
1020
@@ -2130,7 +2106,7 @@ bool CConnman::Start(boost::thread_group& threadGroup, CScheduler& scheduler, st
2130
2106
uint64_t nonce = GetDeterministicRandomizer (RANDOMIZER_ID_LOCALHOSTNONCE).Write (id).Finalize ();
2131
2107
2132
2108
pnodeLocalHost = new CNode (id, nLocalServices, GetBestHeight (), INVALID_SOCKET, CAddress (CService (local, 0 ), nLocalServices), 0 , nonce);
2133
- GetNodeSignals ().InitializeNode (pnodeLocalHost-> GetId (), pnodeLocalHost );
2109
+ GetNodeSignals ().InitializeNode (pnodeLocalHost, * this );
2134
2110
}
2135
2111
2136
2112
//
0 commit comments