mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
refactor: use try_emplace over emplace
This commit is contained in:
parent
b6907d2bea
commit
66351aaaf9
@ -653,9 +653,9 @@ void CQuorumBlockProcessor::AddMineableCommitment(const CFinalCommitment& fqc)
|
||||
LOCK(minableCommitmentsCs);
|
||||
|
||||
auto k = std::make_pair(fqc.llmqType, fqc.quorumHash);
|
||||
auto ins = minableCommitmentsByQuorum.emplace(k, commitmentHash);
|
||||
auto ins = minableCommitmentsByQuorum.try_emplace(k, commitmentHash);
|
||||
if (ins.second) {
|
||||
minableCommitments.emplace(commitmentHash, fqc);
|
||||
minableCommitments.try_emplace(commitmentHash, fqc);
|
||||
relay = true;
|
||||
} else {
|
||||
const auto& oldFqc = minableCommitments.at(ins.first->second);
|
||||
@ -663,7 +663,7 @@ void CQuorumBlockProcessor::AddMineableCommitment(const CFinalCommitment& fqc)
|
||||
// new commitment has more signers, so override the known one
|
||||
ins.first->second = commitmentHash;
|
||||
minableCommitments.erase(ins.first->second);
|
||||
minableCommitments.emplace(commitmentHash, fqc);
|
||||
minableCommitments.try_emplace(commitmentHash, fqc);
|
||||
relay = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user