Skip to content

Commit

Permalink
Add PoW functionality for mining on regtest
Browse files Browse the repository at this point in the history
  • Loading branch information
ioncoincore authored and FornaxA committed Feb 5, 2019
1 parent 22b2e9a commit bf6cf19
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/accumulators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ bool CalculateAccumulatorCheckpoint(int nHeight, uint256& nCheckpoint, Accumulat

//Accumulate all coins over the last ten blocks that havent been accumulated (height - 20 through height - 11)
int nTotalMintsFound = 0;
CBlockIndex *pindex = chainActive[nHeight - 20];
CBlockIndex *pindex = chainActive[nHeight >= 20 ? nHeight - 20 : 0];

//On a specific block, a recalculation of the accumulators will be forced
if (nHeight == Params().Zerocoin_Block_RecalculateAccumulators()) {
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4156,7 +4156,7 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo

// Check that the header is valid (particularly PoW). This is mostly
// redundant with the call in AcceptBlockHeader.
if (!CheckBlockHeader(block, state, block.IsProofOfWork()))
if (!CheckBlockHeader(block, state, block.IsProofOfWork() && fCheckPOW))
return state.DoS(100, error("CheckBlock() : CheckBlockHeader failed"),
REJECT_INVALID, "bad-header", true);

Expand Down
4 changes: 4 additions & 0 deletions src/masternode-payments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,10 @@ void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, int64_t nFe
CBitcoinAddress address2(address1);

LogPrint("masternode","Masternode payment of %s to %s\n", FormatMoney(masternodePayment).c_str(), address2.ToString().c_str());
} else {
if (!fProofOfStake) {
txNew.vout[0].nValue = blockValue;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,11 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn, CWallet* pwallet,
LogPrintf("CreateNewBlock(): total size %u\n", nBlockSize);

// Compute final coinbase transaction.
pblock->vtx[0].vin[0].scriptSig = CScript() << nHeight << OP_0;
if (!fProofOfStake) {
pblock->vtx[0] = txNew;
pblocktemplate->vTxFees[0] = -nFees;
}
pblock->vtx[0].vin[0].scriptSig = CScript() << nHeight << OP_0;

// Fill in header
pblock->hashPrevBlock = pindexPrev->GetBlockHash();
Expand Down

0 comments on commit bf6cf19

Please sign in to comment.