diff options
author | Matt Corallo <git@bluematt.me> | 2016-12-04 00:17:30 -0800 |
---|---|---|
committer | Matt Corallo <git@bluematt.me> | 2016-12-04 00:17:30 -0800 |
commit | 2d6e5619afa2d43a37a0a38daf33f58965ddfa80 (patch) | |
tree | 9bdc85dfd1048bc7d7f2d535d9f63b3b373ef4d9 /src/validation.cpp | |
parent | 2736c44c8edea5ce6a502a04269926fecda27301 (diff) |
Switch pblock in ProcessNewBlock to a shared_ptr
This (finally) fixes a performance regression in
b3b3c2a5623d5c942d2b3565cc2d833c65105555
Diffstat (limited to 'src/validation.cpp')
-rw-r--r-- | src/validation.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index bd66c5679b..0983c1f762 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3123,7 +3123,7 @@ static bool AcceptBlock(const CBlock& block, CValidationState& state, const CCha return true; } -bool ProcessNewBlock(const CChainParams& chainparams, const CBlock* pblock, bool fForceProcessing, const CDiskBlockPos* dbp, bool *fNewBlock) +bool ProcessNewBlock(const CChainParams& chainparams, const std::shared_ptr<const CBlock> pblock, bool fForceProcessing, const CDiskBlockPos* dbp, bool *fNewBlock) { { LOCK(cs_main); @@ -3142,13 +3142,8 @@ bool ProcessNewBlock(const CChainParams& chainparams, const CBlock* pblock, bool NotifyHeaderTip(); - //TODO: This copy is a major performance regression, but callers need updated to fix this - std::shared_ptr<const CBlock> block_ptr; - if (pblock) - block_ptr.reset(new CBlock(*pblock)); - CValidationState state; // Only used to report errors, not invalidity - ignore it - if (!ActivateBestChain(state, chainparams, block_ptr)) + if (!ActivateBestChain(state, chainparams, pblock)) return error("%s: ActivateBestChain failed", __func__); return true; |