Skip to content

Commit 58cf974

Browse files
committed
Remove serialization of CBlockHeader::nNonce in block version 11
Besides early blocks, Gridcoin uses Proof-of-Stake for consensus, so we don't need the nonce field. Don't serialize it after blocks version 11 and later.
1 parent d462f5c commit 58cf974

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/main.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,14 @@ class CBlockHeader
10311031
READWRITE(hashMerkleRoot);
10321032
READWRITE(nTime);
10331033
READWRITE(nBits);
1034-
READWRITE(nNonce);
1034+
1035+
// Besides early blocks, Gridcoin uses Proof-of-Stake for consensus,
1036+
// so we don't need the nonce field. Don't serialize it after blocks
1037+
// version 11 and later:
1038+
//
1039+
if (nVersion <= 10) {
1040+
READWRITE(nNonce);
1041+
}
10351042
}
10361043

10371044
void SetNull()
@@ -1051,7 +1058,9 @@ class CBlockHeader
10511058

10521059
uint256 GetHash() const
10531060
{
1054-
if (nVersion >= 7)
1061+
if (nVersion >= 11)
1062+
return Hash(BEGIN(nVersion), END(nBits));
1063+
else if (nVersion >= 7)
10551064
return Hash(BEGIN(nVersion), END(nNonce));
10561065
else
10571066
return GetPoWHash();

0 commit comments

Comments
 (0)