Block parser: sanity check minor version

This commit is contained in:
SChernykh 2024-06-03 11:29:01 +02:00
parent 9a9f6379cd
commit 4bc0b559cb

View file

@ -61,21 +61,17 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
#define READ_BUF(buf, size) do { if (!read_buf((buf), (size))) return __LINE__; } while(0)
if (!merge_mining_enabled()) {
READ_BYTE(m_majorVersion);
READ_BYTE(m_minorVersion);
}
else {
READ_VARINT(m_majorVersion);
READ_VARINT(m_minorVersion);
}
READ_BYTE(m_majorVersion);
if (m_majorVersion > HARDFORK_SUPPORTED_VERSION) return __LINE__;
READ_BYTE(m_minorVersion);
if (m_minorVersion < m_majorVersion) return __LINE__;
READ_VARINT(m_timestamp);
READ_BUF(m_prevId.h, HASH_SIZE);
if (merge_mining_enabled() && (m_minorVersion > 127)) return __LINE__;
const int nonce_offset = static_cast<int>(data - data_begin);
READ_BUF(&m_nonce, NONCE_SIZE);