@@ -491,47 +491,47 @@ struct CNodeState {
491
491
// ! The peer's address
492
492
const CService address;
493
493
// ! The best known block we know this peer has announced.
494
- const CBlockIndex * pindexBestKnownBlock;
494
+ const CBlockIndex* pindexBestKnownBlock{ nullptr } ;
495
495
// ! The hash of the last unknown block this peer has announced.
496
- uint256 hashLastUnknownBlock;
496
+ uint256 hashLastUnknownBlock{} ;
497
497
// ! The last full block we both have.
498
- const CBlockIndex * pindexLastCommonBlock;
498
+ const CBlockIndex* pindexLastCommonBlock{ nullptr } ;
499
499
// ! The best header we have sent our peer.
500
- const CBlockIndex * pindexBestHeaderSent;
500
+ const CBlockIndex* pindexBestHeaderSent{ nullptr } ;
501
501
// ! Length of current-streak of unconnecting headers announcements
502
- int nUnconnectingHeaders;
502
+ int nUnconnectingHeaders{ 0 } ;
503
503
// ! Whether we've started headers synchronization with this peer.
504
- bool fSyncStarted ;
504
+ bool fSyncStarted { false } ;
505
505
// ! When to potentially disconnect peer for stalling headers download
506
506
std::chrono::microseconds m_headers_sync_timeout{0us};
507
507
// ! Since when we're stalling block download progress (in microseconds), or 0.
508
508
std::chrono::microseconds m_stalling_since{0us};
509
509
std::list<QueuedBlock> vBlocksInFlight;
510
510
// ! When the first entry in vBlocksInFlight started downloading. Don't care when vBlocksInFlight is empty.
511
511
std::chrono::microseconds m_downloading_since{0us};
512
- int nBlocksInFlight;
513
- int nBlocksInFlightValidHeaders;
512
+ int nBlocksInFlight{ 0 } ;
513
+ int nBlocksInFlightValidHeaders{ 0 } ;
514
514
// ! Whether we consider this a preferred download peer.
515
- bool fPreferredDownload ;
515
+ bool fPreferredDownload { false } ;
516
516
// ! Whether this peer wants invs or headers (when possible) for block announcements.
517
- bool fPreferHeaders ;
517
+ bool fPreferHeaders { false } ;
518
518
// ! Whether this peer wants invs or cmpctblocks (when possible) for block announcements.
519
- bool fPreferHeaderAndIDs ;
519
+ bool fPreferHeaderAndIDs { false } ;
520
520
/* *
521
521
* Whether this peer will send us cmpctblocks if we request them.
522
522
* This is not used to gate request logic, as we really only care about fSupportsDesiredCmpctVersion,
523
523
* but is used as a flag to "lock in" the version of compact blocks (fWantsCmpctWitness) we send.
524
524
*/
525
- bool fProvidesHeaderAndIDs ;
525
+ bool fProvidesHeaderAndIDs { false } ;
526
526
// ! Whether this peer can give us witnesses
527
- bool fHaveWitness ;
527
+ bool fHaveWitness { false } ;
528
528
// ! Whether this peer wants witnesses in cmpctblocks/blocktxns
529
- bool fWantsCmpctWitness ;
529
+ bool fWantsCmpctWitness { false } ;
530
530
/* *
531
531
* If we've announced NODE_WITNESS to this peer: whether the peer sends witnesses in cmpctblocks/blocktxns,
532
532
* otherwise: whether this peer sends non-witnesses in cmpctblocks/blocktxns.
533
533
*/
534
- bool fSupportsDesiredCmpctVersion ;
534
+ bool fSupportsDesiredCmpctVersion { false } ;
535
535
536
536
/* * State used to enforce CHAIN_SYNC_TIMEOUT and EXTRA_PEER_CHECK_INTERVAL logic.
537
537
*
@@ -568,13 +568,13 @@ struct CNodeState {
568
568
bool m_protect;
569
569
};
570
570
571
- ChainSyncTimeoutState m_chain_sync;
571
+ ChainSyncTimeoutState m_chain_sync{ 0 , nullptr , false , false } ;
572
572
573
573
// ! Time of last new block announcement
574
- int64_t m_last_block_announcement;
574
+ int64_t m_last_block_announcement{ 0 } ;
575
575
576
576
// ! Whether this peer is an inbound connection
577
- bool m_is_inbound;
577
+ const bool m_is_inbound;
578
578
579
579
// ! A rolling bloom filter of all announced tx CInvs to this peer.
580
580
CRollingBloomFilter m_recently_announced_invs = CRollingBloomFilter{INVENTORY_MAX_RECENT_RELAY, 0.000001 };
@@ -585,23 +585,6 @@ struct CNodeState {
585
585
CNodeState (CAddress addrIn, bool is_inbound)
586
586
: address(addrIn), m_is_inbound(is_inbound)
587
587
{
588
- pindexBestKnownBlock = nullptr ;
589
- hashLastUnknownBlock.SetNull ();
590
- pindexLastCommonBlock = nullptr ;
591
- pindexBestHeaderSent = nullptr ;
592
- nUnconnectingHeaders = 0 ;
593
- fSyncStarted = false ;
594
- nBlocksInFlight = 0 ;
595
- nBlocksInFlightValidHeaders = 0 ;
596
- fPreferredDownload = false ;
597
- fPreferHeaders = false ;
598
- fPreferHeaderAndIDs = false ;
599
- fProvidesHeaderAndIDs = false ;
600
- fHaveWitness = false ;
601
- fWantsCmpctWitness = false ;
602
- fSupportsDesiredCmpctVersion = false ;
603
- m_chain_sync = { 0 , nullptr , false , false };
604
- m_last_block_announcement = 0 ;
605
588
m_recently_announced_invs.reset ();
606
589
}
607
590
};
0 commit comments