Moved UpdateTime out of CBlockHeader and moved CBlockHeader into core.
This commit is contained in:
10
src/main.cpp
10
src/main.cpp
@@ -1300,13 +1300,13 @@ bool ConnectBestBlock(CValidationState &state) {
|
||||
} while(true);
|
||||
}
|
||||
|
||||
void CBlockHeader::UpdateTime(const CBlockIndex* pindexPrev)
|
||||
void UpdateTime(CBlockHeader& block, const CBlockIndex* pindexPrev)
|
||||
{
|
||||
nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
|
||||
block.nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
|
||||
|
||||
// Updating time can change work required on testnet:
|
||||
if (fTestNet)
|
||||
nBits = GetNextWorkRequired(pindexPrev, this);
|
||||
block.nBits = GetNextWorkRequired(pindexPrev, &block);
|
||||
}
|
||||
|
||||
|
||||
@@ -4366,7 +4366,7 @@ CBlockTemplate* CreateNewBlock(CReserveKey& reservekey)
|
||||
|
||||
// Fill in header
|
||||
pblock->hashPrevBlock = pindexPrev->GetBlockHash();
|
||||
pblock->UpdateTime(pindexPrev);
|
||||
UpdateTime(*pblock, pindexPrev);
|
||||
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock);
|
||||
pblock->nNonce = 0;
|
||||
pblock->vtx[0].vin[0].scriptSig = CScript() << OP_0 << OP_0;
|
||||
@@ -4606,7 +4606,7 @@ void static BitcoinMiner(CWallet *pwallet)
|
||||
break;
|
||||
|
||||
// Update nTime every few seconds
|
||||
pblock->UpdateTime(pindexPrev);
|
||||
UpdateTime(*pblock, pindexPrev);
|
||||
nBlockTime = ByteReverse(pblock->nTime);
|
||||
if (fTestNet)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user