Skip to content

Conversation

@codablock
Copy link

This is extracted from #2566. It removes most uses of CMasternodeMan and replaces it with direct use of deterministicMNManager. I tried to avoid mixing in code removal as much as possible, but this was still required in some places where deterministicMNManager can not provide the same (legacy) functionality. I also had to remove support for legacy operator keys in various Sign/Verify methods as the legacy operator pubkey is not available anymore when directly using deterministicMNManager.

This leaves CMasternodeMan and most of its code unused. It's now only used for governance and PS metadata. The next PR will remove all unused code and the PR after that will refactor CMasternodeMan into CMasternodeMetaMan (as seen in #2566).

And remove them with direct use of deterministicMNManager
…e used directly

Additionally, implement GetLastDsq in CMasternodeMan as a replacement
for direct access to the masternode_info_t object. Will move this variable
to another (PS specific) place later.
And adapt it to directly use deterministicMNManager
Has to be replaced with something new in the future.
…ticMNCPtr

This leaves us with nMinProtocol unused, but this is ok as we will later
remove that argument completely.
…ing DMNs now

It's ok to remove this code as we're later going to completely remove it.
Until then, this code is dead nevertheless.
This relies on mnInfo which is not present anymore as we directly use
deterministicMNManager now.
@codablock codablock added this to the 14.0 milestone Dec 31, 2018
Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See inline comments

mn.nProtocolVersion << " " <<
payeeStr << " " <<
(int64_t)mn.lastPing.sigTime << " " << std::setw(8) <<
(int64_t)(mn.lastPing.sigTime - mn.sigTime) << " " << std::setw(10) <<
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should keep << std::setw(10) <<
(can't create suggestions on deleted lines :/ )

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

" payee - Print Dash address associated with a masternode (can be additionally filtered,\n"
" partial match)\n"
" protocol - Print protocol of a masternode (can be additionally filtered, exact match)\n"
" keyid - Print the masternode (not collateral) key id\n"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: keyid seems to be not used anywhere and keyID(Owner/Operator/Voting) neither listed in help nor accepted as a legit option in masternodelist 🙈

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed keyid for now. Not sure how to proceed with the missing options, as I'm not sure how we'll proceed with parallel support of protx list and masternode list.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While reading the comments that came after this one I realized that the help text needed some more fixes nevertheless, including keyID(Owner/Operator/Voting). So, this is fixed now.

payeeScript = GetScriptForDestination(mn.keyIDCollateralAddress);

auto mnList = deterministicMNManager->GetListAtChainTip();
auto dmnToStatus = [&](const CDeterministicMNCPtr& dmn) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: feels like we should move the logic for IsValid() and IsPoSeBanned() and their string representation (this piece -> GetStatus()) into CDeterministicMNState. Basically, replicate the same interface we have for non-deterministic MNs already (and do not expose the logic to rpc or whatever).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yeah sounds like a refactoring is needed here. I've put it onto my TODO list.

}
return "UNKNOWN";
};
auto dmnToLastPaidTime = [&](const CDeterministicMNCPtr& dmn) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, this could be e.g. GetLastPaidTime() in CDeterministicMNState

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my TODO now.

UdjinM6 and others added 3 commits December 31, 2018 13:57
1. Make strMode lower case before comparing it (keyIDXXX would otherwise
   be case sensitive, leading to confusion for users)
2. Remove "rank" and "keyid" mode from help
3. Add keyIDOwner/keyIDVoting/pubKeyOperator to help and strMode check
4. Remove "pubkey" from strMode check
5. Call ToString() on address instead of whole DMN state
6. Add missing std::setw(10) to "full" mode
@codablock
Copy link
Author

Fixed and pushed code review fixes

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly tested (synced, reindexed, tried a couple of masternode list commands).

ACK

@codablock codablock merged commit 46a6fc3 into dashpay:develop Jan 2, 2019
@codablock codablock deleted the pr_dip3_cleanup_directlyusedmnmgr branch January 2, 2019 05:58
knst added a commit to knst/dash that referenced this pull request Jul 3, 2023
It removes 2 unused flags:
 - BIP9CheckMasternodesUpgraded from CChainParams
 - check_mn_protocol from versionbitsinfo

These flags have no meaning since 17c792c (PR dashpay#2594)

The TODO in removed code is super-seeded by new way to validate MN version
in hard-fork (see dashpay#5469 and DIP0023 for more details)
PastaPastaPasta pushed a commit that referenced this pull request Jul 4, 2023
## Issue being fixed or feature implemented
During implementation #5469 (master node hard-fork) I noticed that some
parts of `CChainParams` are deprecated and can be removed.

## What was done?
1. removed methods from `CChainParams` that have no implementation at
all:
 - UpdateSubsidyAndDiffParams
 - UpdateLLMQChainLocks
 - UpdateLLMQTestParams
 - UpdateLLMQDevnetParams
2. removed method `BIP9CheckMasternodesUpgraded` from `CChainParams` and
a flag `check_mn_protocol` from `versionbitsinfo`.
(to follow-up #2594)


## How Has This Been Tested?
Run functional/unit tests.

## 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 _(for repository
code-owners and collaborators only)_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants