diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2013-10-12 15:22:33 +0200 |
---|---|---|
committer | Pieter Wuille <sipa@ulyssis.org> | 2013-10-15 11:09:29 +0200 |
commit | f9b15a4fc94cdd4b535a2f7b1eccc04332367d00 (patch) | |
tree | c4adc198ccc98141d97764f24447568b1cc2c7f3 /src/core.h | |
parent | e4daecda0bcd47a2672eb625232f00e388a3cd87 (diff) |
Move CBlockLocator to core.h
As CBlockLocator is a P2P data structure, and independent from the
validation logic, it can be moved to core.
Diffstat (limited to 'src/core.h')
-rw-r--r-- | src/core.h | 34 |
1 files changed, 34 insertions, 0 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<uint256> vHave; + + CBlockLocator() {} + + CBlockLocator(const std::vector<uint256>& vHaveIn) + { + vHave = vHaveIn; + } + + IMPLEMENT_SERIALIZE + ( + if (!(nType & SER_GETHASH)) + READWRITE(nVersion); + READWRITE(vHave); + ) + + void SetNull() + { + vHave.clear(); + } + + bool IsNull() + { + return vHave.empty(); + } +}; + #endif |