mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +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);
|
LOCK(minableCommitmentsCs);
|
||||||
|
|
||||||
auto k = std::make_pair(fqc.llmqType, fqc.quorumHash);
|
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) {
|
if (ins.second) {
|
||||||
minableCommitments.emplace(commitmentHash, fqc);
|
minableCommitments.try_emplace(commitmentHash, fqc);
|
||||||
relay = true;
|
relay = true;
|
||||||
} else {
|
} else {
|
||||||
const auto& oldFqc = minableCommitments.at(ins.first->second);
|
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
|
// new commitment has more signers, so override the known one
|
||||||
ins.first->second = commitmentHash;
|
ins.first->second = commitmentHash;
|
||||||
minableCommitments.erase(ins.first->second);
|
minableCommitments.erase(ins.first->second);
|
||||||
minableCommitments.emplace(commitmentHash, fqc);
|
minableCommitments.try_emplace(commitmentHash, fqc);
|
||||||
relay = true;
|
relay = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user