Changeset View
Changeset View
Standalone View
Standalone View
src/primitives/block.h
Show First 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | |||||
* node doesn't have the same branch, it can find a recent common trunk. The | * 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. | * further back it is, the further before the fork it may be. | ||||
*/ | */ | ||||
struct CBlockLocator { | struct CBlockLocator { | ||||
std::vector<uint256> vHave; | std::vector<uint256> vHave; | ||||
CBlockLocator() {} | CBlockLocator() {} | ||||
CBlockLocator(const std::vector<uint256> &vHaveIn) { vHave = vHaveIn; } | CBlockLocator(const std::vector<uint256> &vHaveIn) : vHave(vHaveIn) {} | ||||
ADD_SERIALIZE_METHODS; | ADD_SERIALIZE_METHODS; | ||||
template <typename Stream, typename Operation> | template <typename Stream, typename Operation> | ||||
inline void SerializationOp(Stream &s, Operation ser_action) { | inline void SerializationOp(Stream &s, Operation ser_action) { | ||||
int nVersion = s.GetVersion(); | int nVersion = s.GetVersion(); | ||||
if (!(s.GetType() & SER_GETHASH)) READWRITE(nVersion); | if (!(s.GetType() & SER_GETHASH)) READWRITE(nVersion); | ||||
READWRITE(vHave); | READWRITE(vHave); | ||||
} | } | ||||
void SetNull() { vHave.clear(); } | void SetNull() { vHave.clear(); } | ||||
bool IsNull() const { return vHave.empty(); } | bool IsNull() const { return vHave.empty(); } | ||||
}; | }; | ||||
#endif // BITCOIN_PRIMITIVES_BLOCK_H | #endif // BITCOIN_PRIMITIVES_BLOCK_H |