From 55966e0cc03f0e380d21a9434b048d4d515b6729 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Fri, 12 Mar 2021 11:37:50 +0000 Subject: [PATCH 1/2] [net processing] Remove CNodeState ctor body It's a no-op. The ctor for RollingBloomFilter already calls reset(). --- src/net_processing.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index c569acd3cb..46fdc81a4a 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -598,11 +598,7 @@ struct CNodeState { //! Whether this peer relays txs via wtxid bool m_wtxid_relay{false}; - CNodeState(bool is_inbound) - : m_is_inbound(is_inbound) - { - m_recently_announced_invs.reset(); - } + CNodeState(bool is_inbound) : m_is_inbound(is_inbound) {} }; /** Map maintaining per-node state. */ From 6927933782acb9b158787e6f35debb916793f6b1 Mon Sep 17 00:00:00 2001 From: John Newbery Date: Fri, 12 Mar 2021 11:39:22 +0000 Subject: [PATCH 2/2] [net processing] Add ChainSyncTimeoutState default initializers Moves the default values closer to the member definitions. --- src/net_processing.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 46fdc81a4a..6ce984348c 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -575,16 +575,16 @@ struct CNodeState { */ struct ChainSyncTimeoutState { //! A timeout used for checking whether our peer has sufficiently synced - int64_t m_timeout; + int64_t m_timeout{0}; //! A header with the work we require on our peer's chain - const CBlockIndex * m_work_header; + const CBlockIndex* m_work_header{nullptr}; //! After timeout is reached, set to true after sending getheaders - bool m_sent_getheaders; + bool m_sent_getheaders{false}; //! Whether this peer is protected from disconnection due to a bad/slow chain - bool m_protect; + bool m_protect{false}; }; - ChainSyncTimeoutState m_chain_sync{0, nullptr, false, false}; + ChainSyncTimeoutState m_chain_sync; //! Time of last new block announcement int64_t m_last_block_announcement{0};