diff options
Diffstat (limited to 'src/main.h')
-rw-r--r-- | src/main.h | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/main.h b/src/main.h index 46d629044a..1cddbae567 100644 --- a/src/main.h +++ b/src/main.h @@ -22,6 +22,7 @@ class CBlock; class CBlockIndex; class CKeyItem; class CReserveKey; +class CBlockLocator; class CAddress; class CInv; @@ -1033,6 +1034,12 @@ public: /** Set/initialize a chain with a given tip. Returns the forking point. */ CBlockIndex *SetTip(CBlockIndex *pindex); + + /** Return a CBlockLocator that refers to a block in this chain (by default the tip). */ + CBlockLocator GetLocator(const CBlockIndex *pindex = NULL) const; + + /** Find the last common block between this chain and a locator. */ + CBlockIndex *FindFork(const CBlockLocator &locator) const; }; /** The currently-connected chain of blocks. */ @@ -1051,13 +1058,6 @@ protected: public: CBlockLocator() {} - explicit CBlockLocator(const CBlockIndex* pindex) - { - Set(pindex); - } - - explicit CBlockLocator(uint256 hashBlock); - CBlockLocator(const std::vector<uint256>& vHaveIn) { vHave = vHaveIn; @@ -1080,16 +1080,7 @@ public: return vHave.empty(); } - /** Given a block initialises the locator to that point in the chain. */ - void Set(const CBlockIndex* pindex); - /** Returns the distance in blocks this locator is from our chain head. */ - int GetDistanceBack(); - /** Returns the first best-chain block the locator contains. */ - CBlockIndex* GetBlockIndex(); - /** Returns the hash of the first best chain block the locator contains. */ - uint256 GetBlockHash(); - /** Returns the height of the first best chain block the locator has. */ - int GetHeight(); + friend class CChain; }; |