SideChain: reduce lock scope in get_outputs_blob

pull/226/head
SChernykh 2022-11-16 14:23:13 +01:00
parent 488ed8e562
commit 79a31ce57c
1 changed files with 29 additions and 28 deletions

View File

@ -696,6 +696,9 @@ bool SideChain::get_outputs_blob(PoolBlock* block, uint64_t total_reward, std::v
{
blob.clear();
std::vector<MinerShare> tmpShares;
std::vector<uint64_t> tmpRewards;
{
ReadLock lock(m_sidechainLock);
auto it = m_blocksById.find(block->m_sidechainId);
@ -722,12 +725,10 @@ bool SideChain::get_outputs_blob(PoolBlock* block, uint64_t total_reward, std::v
return true;
}
std::vector<MinerShare> tmpShares;
std::vector<uint64_t> tmpRewards;
if (!get_shares(block, tmpShares) || !split_reward(total_reward, tmpShares, tmpRewards) || (tmpRewards.size() != tmpShares.size())) {
return false;
}
}
const size_t n = tmpShares.size();