mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-12-22 11:29:23 +00:00
Block parser: sanity check minor version
This commit is contained in:
parent
9a9f6379cd
commit
4bc0b559cb
1 changed files with 5 additions and 9 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue