mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
refactor: resolve clang tidy warnings in governance (#4194)
* refac: use .empty() * refac: remove redundant string initialization * refac: 'find' called with a string literal consisting of a single character; consider using the more effective overload accepting a character * refac: use empty * refac: access static member statically * Update src/governance/governance-object.cpp Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com> Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
This commit is contained in:
parent
55be0003e2
commit
d444752591
@ -62,7 +62,7 @@ CAmount ParsePaymentAmount(const std::string& strAmount)
|
||||
throw std::runtime_error(ostr.str());
|
||||
}
|
||||
|
||||
pos = strAmount.find(".");
|
||||
pos = strAmount.find('.');
|
||||
if (pos == 0) {
|
||||
// JSON doesn't allow values to start with a decimal point
|
||||
std::ostringstream ostr;
|
||||
@ -71,7 +71,7 @@ CAmount ParsePaymentAmount(const std::string& strAmount)
|
||||
}
|
||||
|
||||
// Make sure there's no more than 1 decimal point
|
||||
if ((pos != std::string::npos) && (strAmount.find(".", pos + 1) != std::string::npos)) {
|
||||
if ((pos != std::string::npos) && (strAmount.find('.', pos + 1) != std::string::npos)) {
|
||||
std::ostringstream ostr;
|
||||
ostr << "ParsePaymentAmount: Invalid amount string, too many decimal points";
|
||||
throw std::runtime_error(ostr.str());
|
||||
@ -513,7 +513,7 @@ void CSuperblock::ParsePaymentSchedule(const std::string& strPaymentAddresses, c
|
||||
throw std::runtime_error(ostr.str());
|
||||
}
|
||||
|
||||
if (vecParsed1.size() == 0) {
|
||||
if (vecParsed1.empty()) {
|
||||
std::ostringstream ostr;
|
||||
ostr << "CSuperblock::ParsePaymentSchedule -- Error no payments";
|
||||
LogPrintf("%s\n", ostr.str());
|
||||
@ -606,7 +606,7 @@ bool CSuperblock::IsValid(const CTransaction& txNew, int nBlockHeight, CAmount b
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string strPayeesPossible = "";
|
||||
std::string strPayeesPossible;
|
||||
|
||||
// CONFIGURE SUPERBLOCK OUTPUTS
|
||||
|
||||
|
@ -546,8 +546,8 @@ bool CGovernanceObject::IsCollateralValid(std::string& strError, bool& fMissingC
|
||||
return false;
|
||||
}
|
||||
|
||||
if (txCollateral->vout.size() < 1) {
|
||||
strError = strprintf("tx vout size less than 1 | %d", txCollateral->vout.size());
|
||||
if (txCollateral->vout.empty()) {
|
||||
strError = "tx vout is empty";
|
||||
LogPrintf("CGovernanceObject::IsCollateralValid -- %s\n", strError);
|
||||
return false;
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ void CGovernanceVote::Relay(CConnman& connman) const
|
||||
// When this vote is from non-valid (PoSe banned) MN, we should only announce it to v0.14.0.1 nodes as older nodes
|
||||
// will ban us otherwise.
|
||||
int minVersion = MIN_GOVERNANCE_PEER_PROTO_VERSION;
|
||||
if (!mnList.IsMNValid(dmn)) {
|
||||
if (!CDeterministicMNList::IsMNValid(dmn)) {
|
||||
minVersion = GOVERNANCE_POSE_BANNED_VOTES_VERSION;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user