Add a 256-bit reserved field to the block header

This field has no defined semantics. While it was added as a result of
discussions about merged mining in #724, this field will not necessarily ever be
used for that purpose.
This commit is contained in:
Jack Grigg
2016-06-07 16:06:25 +12:00
parent d0cc00207b
commit a8d384aeda
4 changed files with 14 additions and 1 deletions

View File

@@ -112,11 +112,12 @@ uint256 CBlock::CheckMerkleBranch(uint256 hash, const std::vector<uint256>& vMer
std::string CBlock::ToString() const
{
std::stringstream s;
s << strprintf("CBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%08x, nNonce=%s, vtx=%u)\n",
s << strprintf("CBlock(hash=%s, ver=%d, hashPrevBlock=%s, hashMerkleRoot=%s, hashReserved=%s, nTime=%u, nBits=%08x, nNonce=%s, vtx=%u)\n",
GetHash().ToString(),
nVersion,
hashPrevBlock.ToString(),
hashMerkleRoot.ToString(),
hashReserved.ToString(),
nTime, nBits, nNonce.ToString(),
vtx.size());
for (unsigned int i = 0; i < vtx.size(); i++)

View File

@@ -25,6 +25,7 @@ public:
int32_t nVersion;
uint256 hashPrevBlock;
uint256 hashMerkleRoot;
uint256 hashReserved;
uint32_t nTime;
uint32_t nBits;
uint256 nNonce;
@@ -43,6 +44,7 @@ public:
nVersion = this->nVersion;
READWRITE(hashPrevBlock);
READWRITE(hashMerkleRoot);
READWRITE(hashReserved);
READWRITE(nTime);
READWRITE(nBits);
READWRITE(nNonce);
@@ -54,6 +56,7 @@ public:
nVersion = CBlockHeader::CURRENT_VERSION;
hashPrevBlock.SetNull();
hashMerkleRoot.SetNull();
hashReserved.SetNull();
nTime = 0;
nBits = 0;
nNonce = uint256();
@@ -115,6 +118,7 @@ public:
block.nVersion = nVersion;
block.hashPrevBlock = hashPrevBlock;
block.hashMerkleRoot = hashMerkleRoot;
block.hashReserved = hashReserved;
block.nTime = nTime;
block.nBits = nBits;
block.nNonce = nNonce;
@@ -155,6 +159,7 @@ public:
nVersion = this->nVersion;
READWRITE(hashPrevBlock);
READWRITE(hashMerkleRoot);
READWRITE(hashReserved);
READWRITE(nTime);
READWRITE(nBits);
}