Masternode related refactorings in preparation of DIP3#2212
Masternode related refactorings in preparation of DIP3#2212UdjinM6 merged 7 commits intodashpay:developfrom
Conversation
src/activemasternode.cpp
Outdated
There was a problem hiding this comment.
Should probably change the name to activeMasternodeInfo for it to be a bit more descriptive.
There was a problem hiding this comment.
Hmm agree. I tried to reduce the number of changed lines so I left this out 🙈
Adding new commit on top for this.
src/activemasternode.h
Outdated
src/activemasternode.h
Outdated
There was a problem hiding this comment.
Should drop pub prefix i.e. s/pubKeyIDMasternode/keyIDMasternode/. Same for all other new CKeyIDs.
There was a problem hiding this comment.
Done in separate commits. I'll probably go crazy because of this when doing the rebase of DIP3 🙈 :D
1885332 to
6a6e9a6
Compare
|
Done the suggested renaming and removed 757b6e5. I don't remember exactly anymore why/when it was needed, will have to figure this out again later when doing the DIP3 rebase. |
UdjinM6
left a comment
There was a problem hiding this comment.
Missed one LogPrintf at line 138 https://github.com/dashpay/dash/blob/6a6e9a6a29dec6de9dd5cf1deed6c6ac78b65541/src/activemasternode.cpp#L138, otherwise looks good 👍
|
Needs rebase |
6a6e9a6 to
9dd511f
Compare
|
Rebased and fixed last nit (squashed into the original commit) |
UdjinM6
left a comment
There was a problem hiding this comment.
Fixes look 👍 Just noticed one more thing though, see below 🙈
| READWRITE(addr); | ||
| READWRITE(pubKeyCollateralAddress); | ||
| READWRITE(pubKeyMasternode); | ||
| READWRITE(keyIDCollateralAddress); |
There was a problem hiding this comment.
Should probably bump CMasternodeMan::SERIALIZATION_VERSION_STRING (masternodeman.cpp#L29) because of changes in serialization.
|
Build fails at Line 164 in 986e734 |
|
Whoops, sorry about that one. Resulted from the recent rebase...verifying fix locally now and then pushing again. |
src/activemasternode.h
Outdated
| #include "primitives/transaction.h" | ||
|
|
||
| class CActiveMasternode; | ||
| class CActiveMasternodeInfo; |
There was a problem hiding this comment.
Heh, compiling locally and
In file included from activemasternode.cpp:5:
./activemasternode.h:25:1: warning: 'CActiveMasternodeInfo' defined as a struct here but previously declared as a class [-Wmismatched-tags]
struct CActiveMasternodeInfo {
^
./activemasternode.h:13:1: note: did you mean struct here?
class CActiveMasternodeInfo;
^~~~~
struct
1 warning generated.
:)
There was a problem hiding this comment.
These fancy Mac users :P
Added a commit to fix it ;)
This is a set of commits extracted from #2083. These are mostly independent from DIP3 and can thus be merged before.
These refactorings are included:
Split CActiveMasternode into CActiveMasternodeInfo and CLegacyActiveMasternodeManager
This splits out the locally active masternode's state into it's own class/object. The actual handling/management of the active masternode is now in CLegacyActiveMasternodeManager. DIP3 will later introduce a new manager, which is then responsible for the deterministic version of the active masternode. After DIP3 deployment is completed, a cleanup PR will remove the legacy masternode manager.
## Update masternode outpoint in case a MNB arrives with a changed outpointThis is not really a refactoring but a new feature. It allows to restart a masternode based on a new collateral. This is likely not so useful for regular MNOs, but quite useful for integration tests and large devnets as it avoids restarting of MNs.
Use CKeyID instead of CPubKey whenever possible in masternode code
This avoids using CPubKey when actually only the key hash is enough. This gets important in DIP3 when the masternode key is split into multiple keys and DIP3 special transactions actually never include the full public key but only the key hash.