Skip to content

Commit

Permalink
Merge branch 'master' into evm_fix_invalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jouzo authored Nov 16, 2023
2 parents 9d11fa2 + 11bced3 commit ee6d378
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,17 @@ ResVal<std::unique_ptr<CBlockTemplate>> BlockAssembler::CreateNewBlock(const CSc
assert(pindexPrev != nullptr);
nHeight = pindexPrev->nHeight + 1;

const auto myIDs = pcustomcsview->AmIOperator();
if (!myIDs) {
return Res::Err("Node has no operators");
}
const auto nodePtr = pcustomcsview->GetMasternode(myIDs->second);
if (!nodePtr || !nodePtr->IsActive(nHeight, *pcustomcsview)) {
return Res::Err("Node is not active");
std::optional<std::pair<CKeyID, uint256>> myIDs;
std::optional<CMasternode> nodePtr;
if (!blockTime) {
myIDs = pcustomcsview->AmIOperator();
if (!myIDs) {
return Res::Err("Node has no operators");
}
nodePtr = pcustomcsview->GetMasternode(myIDs->second);
if (!nodePtr || !nodePtr->IsActive(nHeight, *pcustomcsview)) {
return Res::Err("Node is not active");
}
}

auto consensus = chainparams.GetConsensus();
Expand Down Expand Up @@ -439,7 +443,7 @@ ResVal<std::unique_ptr<CBlockTemplate>> BlockAssembler::CreateNewBlock(const CSc
pblock->hashPrevBlock = pindexPrev->GetBlockHash();
pblock->deprecatedHeight = pindexPrev->nHeight + 1;
pblock->nBits = pos::GetNextWorkRequired(pindexPrev, pblock->nTime, consensus);
if (!blockTime) {
if (myIDs) {
pblock->stakeModifier = pos::ComputeStakeModifier(pindexPrev->stakeModifier, myIDs->first);
}

Expand Down

0 comments on commit ee6d378

Please sign in to comment.