Skip to content

Commit 4231c57

Browse files
PastaPastaPastaknst
authored andcommitted
Merge dashpay#6647: perf: remove extra lookup to map during BuildNewListFromBlock
4a43c62 fix: clearify nullptr value in case of payee is nullptr (Konstantin Akimov) b375c38 perf: remove extra lookup to map during BuildNewListFromBlock (Konstantin Akimov) Pull request description: ## What was done? Removed double lookup in a map with all masternodes: with `HasMN` and `GetMN`. ## How Has This Been Tested? Run unit/functional tests ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK 4a43c62 PastaPastaPasta: utACK 4a43c62 Tree-SHA512: 82d67995c8e5dd6c28668cf8ac583f08468c1607143d0676db358c1fba5fd824512ae374b9e5bc13058b061f1695b7eac1ff8f149d69f553daa6b4968fb8fa25
1 parent 73ec87c commit 4231c57

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/evo/deterministicmns.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -888,10 +888,7 @@ bool CDeterministicMNManager::BuildNewListFromBlock(const CBlock& block, gsl::no
888888

889889
// The payee for the current block was determined by the previous block's list, but it might have disappeared in the
890890
// current block. We still pay that MN one last time, however.
891-
if (payee && newList.HasMN(payee->proTxHash)) {
892-
auto dmn = newList.GetMN(payee->proTxHash);
893-
// HasMN has reported that GetMN should succeed, enforce that.
894-
assert(dmn);
891+
if (auto dmn = payee ? newList.GetMN(payee->proTxHash) : nullptr) {
895892
auto newState = std::make_shared<CDeterministicMNState>(*dmn->pdmnState);
896893
newState->nLastPaidHeight = nHeight;
897894
// Starting from v19 and until MNRewardReallocation, EvoNodes will be paid 4 blocks in a row

0 commit comments

Comments
 (0)