fix: avoid lock annotation for govman.cs in voteraw

This commit is contained in:
Konstantin Akimov 2024-10-06 22:49:50 +07:00
parent 07aa0961c4
commit 982fc9a069
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524

View File

@ -955,14 +955,14 @@ static RPCHelpMan voteraw()
const NodeContext& node = EnsureAnyNodeContext(request.context);
CHECK_NONFATAL(node.govman);
GovernanceObject govObjType = WITH_LOCK(node.govman->cs, return [&](){
AssertLockHeld(node.govman->cs);
GovernanceObject govObjType = [&]() {
LOCK(node.govman->cs);
const CGovernanceObject *pGovObj = node.govman->FindConstGovernanceObject(hashGovObj);
if (!pGovObj) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Governance object not found");
}
return pGovObj->GetObjectType();
}());
}();
int64_t nTime = request.params[5].get_int64();