Merge #6101: fix: cppcheck warnings

3d8ff0cd2d fix: cppcheck warning about coinst in rpc/coinjoin (Konstantin Akimov)
63dfdd7d42 fix: workaround for buggy cppcheck in masternode/utils (Konstantin Akimov)

Pull request description:

  ## Issue being fixed or feature implemented

  `cppcheck 2.11` on my localhost returns 2 failures, that are not caught by our CI, probably due to difference in version:

      ```
      src/rpc/coinjoin.cpp:73:28: warning: Variable 'chainman' can be declared as reference to const [constVariableReference]
       src/masternode/utils.cpp:0:0: warning: Internal Error. MathLib::toLongNumber: input was not completely consumed: 5s [cppcheckError]

      Advice not applicable in this specific case? Add an exception by updating
      IGNORED_WARNINGS in test/lint/lint-cppcheck-dash.sh
      ```

  ## What was done?
  Adds missing const, workaround for probably a crash in cppcheck 2.11.

  ## How Has This Been Tested?
  Run `test/lint/lint-cppcheck-dash.sh`

  ## Breaking Changes
  N/A

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone

ACKs for top commit:
  UdjinM6:
    utACK 3d8ff0cd2d
  PastaPastaPasta:
    utACK 3d8ff0cd2d

Tree-SHA512: c4c7e839161a6eb8d7a25b48cd05914d94dc4e4a6d53cbd39728a74a39d626d9b533afd98a9803550d2754df5c86445e5157e0e48853af52ea5ea5cb2e15d97b
This commit is contained in:
pasta 2024-07-09 09:38:06 -05:00
commit 1f113587fb
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984
2 changed files with 2 additions and 2 deletions

View File

@ -67,7 +67,7 @@ void CMasternodeUtils::DoMaintenance(CConnman& connman, CDeterministicMNManager&
if (pnode->IsInboundConn()) {
return;
}
} else if (GetTime<std::chrono::seconds>() - pnode->m_connected < 5s) {
} else if (GetTime<std::chrono::seconds>() - pnode->m_connected < PROBE_WAIT_INTERVAL) {
// non-verified, give it some time to verify itself
return;
} else if (pnode->qwatch) {

View File

@ -70,7 +70,7 @@ static RPCHelpMan coinjoin()
throw JSONRPCError(RPC_INTERNAL_ERROR, "Mixing has been started already.");
}
ChainstateManager& chainman = EnsureChainman(node);
const ChainstateManager& chainman = EnsureChainman(node);
CTxMemPool& mempool = EnsureMemPool(node);
CConnman& connman = EnsureConnman(node);
bool result = cj_clientman->DoAutomaticDenominating(chainman.ActiveChainstate(), connman, mempool);