From 77a2c2f8f91a5c5a140fd970f9a3a142b43902bf Mon Sep 17 00:00:00 2001 From: John Newbery Date: Fri, 19 Jun 2020 13:17:41 -0400 Subject: [net processing] Move nStartingHeight to Peer --- src/net_processing.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/net_processing.h') diff --git a/src/net_processing.h b/src/net_processing.h index 3600fe7d63..5af2689f18 100644 --- a/src/net_processing.h +++ b/src/net_processing.h @@ -36,6 +36,7 @@ struct CNodeStateStats { int m_misbehavior_score = 0; int nSyncHeight = -1; int nCommonHeight = -1; + int nStartingHeight = -1; std::vector vHeightInFlight; }; @@ -62,6 +63,9 @@ struct Peer { /** Whether this peer should be disconnected and marked as discouraged (unless it has the noban permission). */ bool m_should_discourage GUARDED_BY(m_misbehavior_mutex){false}; + /** This peer's reported block height when we connected */ + std::atomic nStartingHeight{-1}; + /** Set of txids to reconsider once their parent transactions have been accepted **/ std::set m_orphan_work_set GUARDED_BY(g_cs_orphans); @@ -182,7 +186,9 @@ private: void ProcessOrphanTx(std::set& orphan_work_set) EXCLUSIVE_LOCKS_REQUIRED(cs_main, g_cs_orphans); /** Process a single headers message from a peer. */ - void ProcessHeadersMessage(CNode& pfrom, const std::vector& headers, bool via_compact_block); + void ProcessHeadersMessage(CNode& pfrom, const Peer& peer, + const std::vector& headers, + bool via_compact_block); void SendBlockTransactions(CNode& pfrom, const CBlock& block, const BlockTransactionsRequest& req); -- cgit v1.2.3