clang-format -i (All Dash Related Files)#2348
Conversation
|
If we're going to add this, we should probably (eventually?) add some kind of CI check for formatting also, otherwise eventually we'll get out of skew with clang-format rules again and have to do other formatting PRs in the future. |
There was a problem hiding this comment.
@nmarley Not everything clang-format does makes it better imo, there are some weird things sometimes and there are things that make readability worse (and not applying them would be a false positive I guess and would break a CI build), see inline comments.
@Duality-CDOO this ^^^ + it's interesting to see the need for 20f8468 and that win32/64 builds are failing on your branch after (what initially looked like) a trivial refactoring. Looks like rearranging #includes revealed a couple of hidden issues (the later one can be fixed by UdjinM6@a7313d3 btw) but I would probably move code changes which fix them into a separate PR and keep this PR clang-format focused.
| mnp.fSentinelIsCurrent = | ||
| (abs(GetAdjustedTime() - nSentinelPingTime) < MASTERNODE_SENTINEL_PING_MAX_SECONDS); | ||
| if(!mnp.Sign(activeMasternodeInfo.keyOperator, activeMasternodeInfo.keyIDOperator)) { | ||
| (abs(GetAdjustedTime() - nSentinelPingTime) < MASTERNODE_SENTINEL_PING_MAX_SECONDS); |
There was a problem hiding this comment.
not sure why it's on a new line at all, I would just make it one-liner instead
| static const int ACTIVE_MASTERNODE_SYNC_IN_PROCESS = 1; | ||
| static const int ACTIVE_MASTERNODE_INPUT_TOO_NEW = 2; | ||
| static const int ACTIVE_MASTERNODE_NOT_CAPABLE = 3; | ||
| static const int ACTIVE_MASTERNODE_STARTED = 4; |
There was a problem hiding this comment.
I'd keep it as is. Same for all the other static consts in other header files.
| enum masternode_type_enum_t { | ||
| MASTERNODE_UNKNOWN = 0, | ||
| MASTERNODE_REMOTE = 1 | ||
| MASTERNODE_REMOTE = 1 |
There was a problem hiding this comment.
I'd keep it as is. Same for all the other enums.
| } std::cout | ||
| << "CGovernanceTriggerManager::CleanAndRemove: Removing object: " | ||
| << strDataAsPlainString | ||
| << std::endl;); |
There was a problem hiding this comment.
That's some clang-format weirdness we already had in some previous attempt, should be reverted.
| // Let's see why this failed | ||
| for (const auto& payee : mnBlockPayees.second.vecPayees) { | ||
| for (const auto& payee | ||
| : mnBlockPayees.second.vecPayees) { |
| (int64_t)(mn.lastPing.sigTime - mn.sigTime) << " " << | ||
| mn.GetLastPaidTime() << " " << | ||
| mn.GetLastPaidBlock(); | ||
| streamInfo << mn.addr.ToString() << " " << CBitcoinAddress(mn.pubKeyCollateralAddress.GetID()).ToString() << " " << mn.GetStatus() << " " << mn.nProtocolVersion << " " << mn.lastPing.nDaemonVersion << " " << mn.lastPing.GetSentinelString() << " " << (mn.lastPing.fSentinelIsCurrent ? "current" : "expired") << " " << (int64_t)mn.lastPing.sigTime << " " << (int64_t)(mn.lastPing.sigTime - mn.sigTime) << " " << mn.GetLastPaidTime() << " " << mn.GetLastPaidBlock(); |
| + HelpExampleRpc("sentinelping", "1.0.2") | ||
| ); | ||
| "\nExamples:\n" + | ||
| HelpExampleCli("sentinelping", "1.0.2") + HelpExampleRpc("sentinelping", "1.0.2")); |
| masternode_info_t(int activeState, int protoVer, int64_t sTime, | ||
| COutPoint const& outpnt, CService const& addr, | ||
| CPubKey const& pkCollAddr, CPubKey const& pkMN) : | ||
| masternode_info_t(int activeState, int protoVer, int64_t sTime, COutPoint const& outpnt, CService const& addr, CPubKey const& pkCollAddr, CPubKey const& pkMN) : |
| masternode_info_t(int activeState, int protoVer, int64_t sTime, | ||
| COutPoint const& outpnt, CService const& addr, | ||
| CKeyID const& pkCollAddr, CKeyID const& pkOwner, CKeyID const& pkOperator, CKeyID const& pkVoting) : | ||
| masternode_info_t(int activeState, int protoVer, int64_t sTime, COutPoint const& outpnt, CService const& addr, CKeyID const& pkCollAddr, CKeyID const& pkOwner, CKeyID const& pkOperator, CKeyID const& pkVoting) : |
| vote_outcome_enum_t eVoteOutcome) | ||
| const uint256& hash, | ||
| vote_signal_enum_t eVoteSignal, | ||
| vote_outcome_enum_t eVoteOutcome) |
|
What this has showed us is that the includes for all files need looking at. |
|
This one is superseded by a bunch of recent PRs by @PastaPastaPasta, closing. |
This applies clang-format -i to all Dash specific files.
Includes for std::string and std::vector had to be added to masternodeconfig.h to allow successful build.