@@ -904,6 +904,11 @@ class CBlock
904904 }
905905
906906 uint256 GetHash () const
907+ {
908+ return GetPoWHash ();
909+ }
910+
911+ uint256 GetPoWHash () const
907912 {
908913 return scrypt_blockhash (CVOIDBEGIN (nVersion));
909914 }
@@ -1047,7 +1052,7 @@ class CBlock
10471052 }
10481053
10491054 // Check the header
1050- if (fReadTransactions && IsProofOfWork () && !CheckProofOfWork (GetHash (), nBits))
1055+ if (fReadTransactions && IsProofOfWork () && !CheckProofOfWork (GetPoWHash (), nBits))
10511056 return error (" CBlock::ReadFromDisk() : errors in block header" );
10521057
10531058 return true ;
@@ -1081,7 +1086,7 @@ class CBlock
10811086 bool ConnectBlock (CTxDB& txdb, CBlockIndex* pindex, bool fJustCheck =false );
10821087 bool ReadFromDisk (const CBlockIndex* pindex, bool fReadTransactions =true );
10831088 bool SetBestChain (CTxDB& txdb, CBlockIndex* pindexNew);
1084- bool AddToBlockIndex (unsigned int nFile, unsigned int nBlockPos, const uint256& hashProofOfStake );
1089+ bool AddToBlockIndex (unsigned int nFile, unsigned int nBlockPos, const uint256& hashProof );
10851090 bool CheckBlock (bool fCheckPOW =true , bool fCheckMerkleRoot =true , bool fCheckSig =true ) const ;
10861091 bool AcceptBlock ();
10871092 bool GetCoinAge (uint64_t & nCoinAge) const ; // ppcoin: calculate total coin age spent in block
@@ -1132,7 +1137,8 @@ class CBlockIndex
11321137 // proof-of-stake specific fields
11331138 COutPoint prevoutStake;
11341139 unsigned int nStakeTime;
1135- uint256 hashProofOfStake;
1140+
1141+ uint256 hashProof;
11361142
11371143 // block header
11381144 int nVersion;
@@ -1155,7 +1161,7 @@ class CBlockIndex
11551161 nFlags = 0 ;
11561162 nStakeModifier = 0 ;
11571163 nStakeModifierChecksum = 0 ;
1158- hashProofOfStake = 0 ;
1164+ hashProof = 0 ;
11591165 prevoutStake.SetNull ();
11601166 nStakeTime = 0 ;
11611167
@@ -1180,7 +1186,7 @@ class CBlockIndex
11801186 nFlags = 0 ;
11811187 nStakeModifier = 0 ;
11821188 nStakeModifierChecksum = 0 ;
1183- hashProofOfStake = 0 ;
1189+ hashProof = 0 ;
11841190 if (block.IsProofOfStake ())
11851191 {
11861192 SetProofOfStake ();
@@ -1318,12 +1324,12 @@ class CBlockIndex
13181324
13191325 std::string ToString () const
13201326 {
1321- return strprintf (" CBlockIndex(nprev=%p, pnext=%p, nFile=%u, nBlockPos=%-6d nHeight=%d, nMint=%s, nMoneySupply=%s, nFlags=(%s)(%d)(%s), nStakeModifier=%016" PRIx64" , nStakeModifierChecksum=%08x, hashProofOfStake =%s, prevoutStake=(%s), nStakeTime=%d merkle=%s, hashBlock=%s)" ,
1327+ return strprintf (" CBlockIndex(nprev=%p, pnext=%p, nFile=%u, nBlockPos=%-6d nHeight=%d, nMint=%s, nMoneySupply=%s, nFlags=(%s)(%d)(%s), nStakeModifier=%016" PRIx64" , nStakeModifierChecksum=%08x, hashProof =%s, prevoutStake=(%s), nStakeTime=%d merkle=%s, hashBlock=%s)" ,
13221328 pprev, pnext, nFile, nBlockPos, nHeight,
13231329 FormatMoney (nMint).c_str (), FormatMoney (nMoneySupply).c_str (),
13241330 GeneratedStakeModifier () ? " MOD" : " -" , GetStakeEntropyBit (), IsProofOfStake ()? " PoS" : " PoW" ,
13251331 nStakeModifier, nStakeModifierChecksum,
1326- hashProofOfStake .ToString ().c_str (),
1332+ hashProof .ToString ().c_str (),
13271333 prevoutStake.ToString ().c_str (), nStakeTime,
13281334 hashMerkleRoot.ToString ().c_str (),
13291335 GetBlockHash ().ToString ().c_str ());
@@ -1377,14 +1383,13 @@ class CDiskBlockIndex : public CBlockIndex
13771383 {
13781384 READWRITE (prevoutStake);
13791385 READWRITE (nStakeTime);
1380- READWRITE (hashProofOfStake);
13811386 }
13821387 else if (fRead )
13831388 {
13841389 const_cast <CDiskBlockIndex*>(this )->prevoutStake .SetNull ();
13851390 const_cast <CDiskBlockIndex*>(this )->nStakeTime = 0 ;
1386- const_cast <CDiskBlockIndex*>(this )->hashProofOfStake = 0 ;
13871391 }
1392+ READWRITE (hashProof);
13881393
13891394 // block header
13901395 READWRITE (this ->nVersion);
0 commit comments