From f9b15a4fc94cdd4b535a2f7b1eccc04332367d00 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sat, 12 Oct 2013 15:22:33 +0200 Subject: Move CBlockLocator to core.h As CBlockLocator is a P2P data structure, and independent from the validation logic, it can be moved to core. --- src/core.h | 34 ++++++++++++++++++++++++++++++++++ src/main.h | 38 -------------------------------------- 2 files changed, 34 insertions(+), 38 deletions(-) diff --git a/src/core.h b/src/core.h index ce21acd59e..9ee8b2edce 100644 --- a/src/core.h +++ b/src/core.h @@ -661,4 +661,38 @@ public: void print() const; }; + +/** Describes a place in the block chain to another node such that if the + * other node doesn't have the same branch, it can find a recent common trunk. + * The further back it is, the further before the fork it may be. + */ +struct CBlockLocator +{ + std::vector vHave; + + CBlockLocator() {} + + CBlockLocator(const std::vector& vHaveIn) + { + vHave = vHaveIn; + } + + IMPLEMENT_SERIALIZE + ( + if (!(nType & SER_GETHASH)) + READWRITE(nVersion); + READWRITE(vHave); + ) + + void SetNull() + { + vHave.clear(); + } + + bool IsNull() + { + return vHave.empty(); + } +}; + #endif diff --git a/src/main.h b/src/main.h index 1cddbae567..fc60ccc0b5 100644 --- a/src/main.h +++ b/src/main.h @@ -22,7 +22,6 @@ class CBlock; class CBlockIndex; class CKeyItem; class CReserveKey; -class CBlockLocator; class CAddress; class CInv; @@ -1047,43 +1046,6 @@ extern CChain chainActive; -/** Describes a place in the block chain to another node such that if the - * other node doesn't have the same branch, it can find a recent common trunk. - * The further back it is, the further before the fork it may be. - */ -class CBlockLocator -{ -protected: - std::vector vHave; -public: - CBlockLocator() {} - - CBlockLocator(const std::vector& vHaveIn) - { - vHave = vHaveIn; - } - - IMPLEMENT_SERIALIZE - ( - if (!(nType & SER_GETHASH)) - READWRITE(nVersion); - READWRITE(vHave); - ) - - void SetNull() - { - vHave.clear(); - } - - bool IsNull() - { - return vHave.empty(); - } - - friend class CChain; -}; - - -- cgit v1.2.3