mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
evo: Avoid some unnecessary copying in BuildNewListFromBlock (#3594)
This commit is contained in:
parent
af2fbbccfb
commit
a7f4f95f10
@ -670,9 +670,9 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, const C
|
|||||||
// has been reached, but the block hash will then point to the block at nMasternodeMinimumConfirmations
|
// has been reached, but the block hash will then point to the block at nMasternodeMinimumConfirmations
|
||||||
int nConfirmations = pindexPrev->nHeight - dmn->pdmnState->nRegisteredHeight;
|
int nConfirmations = pindexPrev->nHeight - dmn->pdmnState->nRegisteredHeight;
|
||||||
if (nConfirmations >= Params().GetConsensus().nMasternodeMinimumConfirmations) {
|
if (nConfirmations >= Params().GetConsensus().nMasternodeMinimumConfirmations) {
|
||||||
CDeterministicMNState newState = *dmn->pdmnState;
|
auto newState = std::make_shared<CDeterministicMNState>(*dmn->pdmnState);
|
||||||
newState.UpdateConfirmedHash(dmn->proTxHash, pindexPrev->GetBlockHash());
|
newState->UpdateConfirmedHash(dmn->proTxHash, pindexPrev->GetBlockHash());
|
||||||
newList.UpdateMN(dmn->proTxHash, std::make_shared<CDeterministicMNState>(newState));
|
newList.UpdateMN(dmn->proTxHash, newState);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -730,17 +730,14 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, const C
|
|||||||
}
|
}
|
||||||
|
|
||||||
dmn->nOperatorReward = proTx.nOperatorReward;
|
dmn->nOperatorReward = proTx.nOperatorReward;
|
||||||
dmn->pdmnState = std::make_shared<CDeterministicMNState>(proTx);
|
|
||||||
|
|
||||||
CDeterministicMNState dmnState = *dmn->pdmnState;
|
|
||||||
dmnState.nRegisteredHeight = nHeight;
|
|
||||||
|
|
||||||
|
auto dmnState = std::make_shared<CDeterministicMNState>(proTx);
|
||||||
|
dmnState->nRegisteredHeight = nHeight;
|
||||||
if (proTx.addr == CService()) {
|
if (proTx.addr == CService()) {
|
||||||
// start in banned pdmnState as we need to wait for a ProUpServTx
|
// start in banned pdmnState as we need to wait for a ProUpServTx
|
||||||
dmnState.nPoSeBanHeight = nHeight;
|
dmnState->nPoSeBanHeight = nHeight;
|
||||||
}
|
}
|
||||||
|
dmn->pdmnState = dmnState;
|
||||||
dmn->pdmnState = std::make_shared<CDeterministicMNState>(dmnState);
|
|
||||||
|
|
||||||
newList.AddMN(dmn);
|
newList.AddMN(dmn);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user