Remove version/hashing options from CBlockLocator/CDiskBlockIndex

pull/28428/head
Cory Fields 1 year ago
parent 8e0d9796da
commit f15f790618

@ -388,6 +388,14 @@ const CBlockIndex* LastCommonAncestor(const CBlockIndex* pa, const CBlockIndex*
/** Used to marshal pointers into hashes for db storage. */ /** Used to marshal pointers into hashes for db storage. */
class CDiskBlockIndex : public CBlockIndex class CDiskBlockIndex : public CBlockIndex
{ {
/** Historically CBlockLocator's version field has been written to disk
* streams as the client version, but the value has never been used.
*
* Hard-code to the highest client version ever written.
* SerParams can be used if the field requires any meaning in the future.
**/
static constexpr int DUMMY_VERSION = 259900;
public: public:
uint256 hashPrev; uint256 hashPrev;
@ -404,8 +412,8 @@ public:
SERIALIZE_METHODS(CDiskBlockIndex, obj) SERIALIZE_METHODS(CDiskBlockIndex, obj)
{ {
LOCK(::cs_main); LOCK(::cs_main);
int _nVersion = s.GetVersion(); int _nVersion = DUMMY_VERSION;
if (!(s.GetType() & SER_GETHASH)) READWRITE(VARINT_MODE(_nVersion, VarIntMode::NONNEGATIVE_SIGNED)); READWRITE(VARINT_MODE(_nVersion, VarIntMode::NONNEGATIVE_SIGNED));
READWRITE(VARINT_MODE(obj.nHeight, VarIntMode::NONNEGATIVE_SIGNED)); READWRITE(VARINT_MODE(obj.nHeight, VarIntMode::NONNEGATIVE_SIGNED));
READWRITE(VARINT(obj.nStatus)); READWRITE(VARINT(obj.nStatus));

@ -118,6 +118,15 @@ public:
*/ */
struct CBlockLocator struct CBlockLocator
{ {
/** Historically CBlockLocator's version field has been written to network
* streams as the negotiated protocol version and to disk streams as the
* client version, but the value has never been used.
*
* Hard-code to the highest protocol version ever written to a network stream.
* SerParams can be used if the field requires any meaning in the future,
**/
static constexpr int DUMMY_VERSION = 70016;
std::vector<uint256> vHave; std::vector<uint256> vHave;
CBlockLocator() {} CBlockLocator() {}
@ -126,8 +135,7 @@ struct CBlockLocator
SERIALIZE_METHODS(CBlockLocator, obj) SERIALIZE_METHODS(CBlockLocator, obj)
{ {
int nVersion = s.GetVersion(); int nVersion = DUMMY_VERSION;
if (!(s.GetType() & SER_GETHASH))
READWRITE(nVersion); READWRITE(nVersion);
READWRITE(obj.vHave); READWRITE(obj.vHave);
} }

Loading…
Cancel
Save