mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
perf: avoid rehashing block; use stored hash (#5435)
before 12% <img width="1538" alt="image" src="https://github.com/dashpay/dash/assets/6443210/fa5043fb-4e48-4728-bfaf-8636d5c20a8c"> after 10% <img width="1544" alt="image" src="https://github.com/dashpay/dash/assets/6443210/1df6aff4-2901-4af1-b421-3604f54df157"> Redundant rehash Avoid redundant rehash Reindexed 0-500000 on testnet None _Go over all the following points, and put an `x` in all the boxes that apply._ - [ ] 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)_
This commit is contained in:
parent
1baf2d5933
commit
382400f0b5
@ -638,7 +638,7 @@ bool CDeterministicMNManager::ProcessBlock(const CBlock& block, const CBlockInde
|
||||
newList.SetHeight(nHeight);
|
||||
}
|
||||
|
||||
newList.SetBlockHash(block.GetHash());
|
||||
newList.SetBlockHash(pindex->GetBlockHash());
|
||||
|
||||
oldList = GetListForBlock(pindex->pprev);
|
||||
diff = oldList.BuildDiff(newList);
|
||||
@ -677,10 +677,10 @@ bool CDeterministicMNManager::ProcessBlock(const CBlock& block, const CBlockInde
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CDeterministicMNManager::UndoBlock(const CBlock& block, const CBlockIndex* pindex)
|
||||
bool CDeterministicMNManager::UndoBlock(const CBlockIndex* pindex)
|
||||
{
|
||||
int nHeight = pindex->nHeight;
|
||||
uint256 blockHash = block.GetHash();
|
||||
uint256 blockHash = pindex->GetBlockHash();
|
||||
|
||||
CDeterministicMNList curList;
|
||||
CDeterministicMNList prevList;
|
||||
|
@ -595,7 +595,7 @@ public:
|
||||
|
||||
bool ProcessBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& state,
|
||||
const CCoinsViewCache& view, bool fJustCheck) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
bool UndoBlock(const CBlock& block, const CBlockIndex* pindex);
|
||||
bool UndoBlock(const CBlockIndex* pindex);
|
||||
|
||||
void UpdatedBlockTip(const CBlockIndex* pindex);
|
||||
|
||||
|
@ -189,7 +189,7 @@ bool UndoSpecialTxsInBlock(const CBlock& block, const CBlockIndex* pindex, llmq:
|
||||
}
|
||||
}
|
||||
|
||||
if (!deterministicMNManager->UndoBlock(block, pindex)) {
|
||||
if (!deterministicMNManager->UndoBlock(pindex)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user