Skip to content

Commit

Permalink
Merge pull request #116 from BlockMechanic/segwit
Browse files Browse the repository at this point in the history
Update miner.cpp
  • Loading branch information
BlockMechanic authored Oct 3, 2022
2 parents dd4c4d4 + ebd0424 commit 9c143dc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,11 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc
coinbaseTx.vpout.resize(1);
coinbaseTx.vpout[0].nAsset = Params().GetConsensus().subsidy_asset;
coinbaseTx.vpout[0].scriptPubKey = scriptPubKeyIn;

if (fProofOfStake && nHeight < Params().PoSStartHeight())
return NULL;

if (fProofOfStake && nHeight >= Params().PoSStartHeight()) {
if (fProofOfStake) {
pblock->nTime = GetAdjustedTime();
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, chainparams.GetConsensus());
bool fStakeFound = false;
Expand Down Expand Up @@ -210,7 +213,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc
}

// Proof of stake blocks pay the mining reward in the coinstake transaction
if (fProofOfStake && nHeight >= Params().PoSStartHeight()) {
if (fProofOfStake) {
CAmount nValueNodeRewards = 0;
if(coinbaseTx.nVersion >= TX_ELE_VERSION){
if (coinbaseTx.vpout.size() > 1)
Expand Down Expand Up @@ -274,7 +277,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc

pblock->vtx[0] = MakeTransactionRef(std::move(coinbaseTx));

if (fProofOfStake && nHeight >= Params().PoSStartHeight()){
if (fProofOfStake){
pblock->vtx.emplace_back();
pblock->vtx[1] = MakeTransactionRef(std::move(txCoinStake));
LogPrintf("%s: vtx size %d\n",__func__, pblock->vtx.size());
Expand Down

0 comments on commit 9c143dc

Please sign in to comment.