@@ -702,41 +702,41 @@ namespace {
702
702
*/
703
703
struct CNodeState {
704
704
// ! The best known block we know this peer has announced.
705
- const CBlockIndex * pindexBestKnownBlock;
705
+ const CBlockIndex* pindexBestKnownBlock{ nullptr } ;
706
706
// ! The hash of the last unknown block this peer has announced.
707
- uint256 hashLastUnknownBlock;
707
+ uint256 hashLastUnknownBlock{} ;
708
708
// ! The last full block we both have.
709
- const CBlockIndex * pindexLastCommonBlock;
709
+ const CBlockIndex* pindexLastCommonBlock{ nullptr } ;
710
710
// ! The best header we have sent our peer.
711
- const CBlockIndex * pindexBestHeaderSent;
711
+ const CBlockIndex* pindexBestHeaderSent{ nullptr } ;
712
712
// ! Length of current-streak of unconnecting headers announcements
713
- int nUnconnectingHeaders;
713
+ int nUnconnectingHeaders{ 0 } ;
714
714
// ! Whether we've started headers synchronization with this peer.
715
- bool fSyncStarted ;
715
+ bool fSyncStarted { false } ;
716
716
// ! When to potentially disconnect peer for stalling headers download
717
717
std::chrono::microseconds m_headers_sync_timeout{0us};
718
718
// ! Since when we're stalling block download progress (in microseconds), or 0.
719
719
std::chrono::microseconds m_stalling_since{0us};
720
720
std::list<QueuedBlock> vBlocksInFlight;
721
721
// ! When the first entry in vBlocksInFlight started downloading. Don't care when vBlocksInFlight is empty.
722
722
std::chrono::microseconds m_downloading_since{0us};
723
- int nBlocksInFlight;
724
- int nBlocksInFlightValidHeaders;
723
+ int nBlocksInFlight{ 0 } ;
724
+ int nBlocksInFlightValidHeaders{ 0 } ;
725
725
// ! Whether we consider this a preferred download peer.
726
- bool fPreferredDownload ;
726
+ bool fPreferredDownload { false } ;
727
727
// ! Whether this peer wants invs or headers (when possible) for block announcements.
728
- bool fPreferHeaders ;
728
+ bool fPreferHeaders { false } ;
729
729
// ! Whether this peer wants invs or compressed headers (when possible) for block announcements.
730
- bool fPreferHeadersCompressed ;
730
+ bool fPreferHeadersCompressed { false } ;
731
731
// ! Whether this peer wants invs or cmpctblocks (when possible) for block announcements.
732
- bool fPreferHeaderAndIDs ;
732
+ bool fPreferHeaderAndIDs { false } ;
733
733
// ! Whether this peer will send us cmpctblocks if we request them
734
- bool fProvidesHeaderAndIDs ;
734
+ bool fProvidesHeaderAndIDs { false } ;
735
735
/* *
736
736
* If we've announced last version to this peer: whether the peer sends last version in cmpctblocks/blocktxns,
737
737
* otherwise: whether this peer sends non-last version in cmpctblocks/blocktxns.
738
738
*/
739
- bool fSupportsDesiredCmpctVersion ;
739
+ bool fSupportsDesiredCmpctVersion { false } ;
740
740
741
741
/* * State used to enforce CHAIN_SYNC_TIMEOUT and EXTRA_PEER_CHECK_INTERVAL logic.
742
742
*
@@ -773,10 +773,10 @@ struct CNodeState {
773
773
bool m_protect{false };
774
774
};
775
775
776
- ChainSyncTimeoutState m_chain_sync;
776
+ ChainSyncTimeoutState m_chain_sync{ 0 , nullptr , false , false } ;
777
777
778
778
// ! Time of last new block announcement
779
- int64_t m_last_block_announcement;
779
+ int64_t m_last_block_announcement{ 0 } ;
780
780
781
781
/*
782
782
* State associated with objects download.
@@ -842,30 +842,14 @@ struct CNodeState {
842
842
ObjectDownloadState m_object_download;
843
843
844
844
// ! Whether this peer is an inbound connection
845
- bool m_is_inbound;
845
+ const bool m_is_inbound;
846
846
847
847
// ! A rolling bloom filter of all announced tx CInvs to this peer.
848
848
CRollingBloomFilter m_recently_announced_invs = CRollingBloomFilter{INVENTORY_MAX_RECENT_RELAY, 0.000001 };
849
849
850
850
CNodeState (bool is_inbound) :
851
851
m_is_inbound (is_inbound)
852
852
{
853
- pindexBestKnownBlock = nullptr ;
854
- hashLastUnknownBlock.SetNull ();
855
- pindexLastCommonBlock = nullptr ;
856
- pindexBestHeaderSent = nullptr ;
857
- nUnconnectingHeaders = 0 ;
858
- fSyncStarted = false ;
859
- nBlocksInFlight = 0 ;
860
- nBlocksInFlightValidHeaders = 0 ;
861
- fPreferredDownload = false ;
862
- fPreferHeaders = false ;
863
- fPreferHeadersCompressed = false ;
864
- fPreferHeaderAndIDs = false ;
865
- fProvidesHeaderAndIDs = false ;
866
- fSupportsDesiredCmpctVersion = false ;
867
- m_chain_sync = { 0 , nullptr , false , false };
868
- m_last_block_announcement = 0 ;
869
853
m_recently_announced_invs.reset ();
870
854
}
871
855
};
0 commit comments