chore: prettify json representations of CSimplifiedMNListEntry and CSimplifiedMNListDiff (#5434)

## Issue being fixed or feature implemented
Should fix
https://github.com/dashpay/dash/pull/5424#discussion_r1228654939 and
make `CSimplifiedMNListEntry`'s json a bit more human-friendly (imo) by
having `nVersion` and `nType` at the top of it.

Move `nVersion` up for `CSimplifiedMNListDiff` too.

NOTE: `nVersion` wasn't actually duplicated in rpc results, it was
simply assigned twice inside. still not nice though.

Thanks @thephez ! 👍 

## What was done?

## How Has This Been Tested?


## 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)_
This commit is contained in:
UdjinM6 2023-06-17 18:50:26 +03:00
parent 44cd30f2f7
commit 8dbdd59be7
No known key found for this signature in database
GPG Key ID: 83592BD1400D58D9

View File

@ -67,14 +67,13 @@ void CSimplifiedMNListEntry::ToJson(UniValue& obj, bool extended) const
obj.clear(); obj.clear();
obj.setObject(); obj.setObject();
obj.pushKV("nVersion", nVersion); obj.pushKV("nVersion", nVersion);
obj.pushKV("nType", ToUnderlying(nType));
obj.pushKV("proRegTxHash", proRegTxHash.ToString()); obj.pushKV("proRegTxHash", proRegTxHash.ToString());
obj.pushKV("confirmedHash", confirmedHash.ToString()); obj.pushKV("confirmedHash", confirmedHash.ToString());
obj.pushKV("service", service.ToString(false)); obj.pushKV("service", service.ToString(false));
obj.pushKV("pubKeyOperator", pubKeyOperator.ToString()); obj.pushKV("pubKeyOperator", pubKeyOperator.ToString());
obj.pushKV("votingAddress", EncodeDestination(PKHash(keyIDVoting))); obj.pushKV("votingAddress", EncodeDestination(PKHash(keyIDVoting)));
obj.pushKV("isValid", isValid); obj.pushKV("isValid", isValid);
obj.pushKV("nVersion", nVersion);
obj.pushKV("nType", ToUnderlying(nType));
if (nType == MnType::HighPerformance) { if (nType == MnType::HighPerformance) {
obj.pushKV("platformHTTPPort", platformHTTPPort); obj.pushKV("platformHTTPPort", platformHTTPPort);
obj.pushKV("platformNodeID", platformNodeID.ToString()); obj.pushKV("platformNodeID", platformNodeID.ToString());
@ -185,6 +184,7 @@ void CSimplifiedMNListDiff::ToJson(UniValue& obj, bool extended) const
{ {
obj.setObject(); obj.setObject();
obj.pushKV("nVersion", nVersion);
obj.pushKV("baseBlockHash", baseBlockHash.ToString()); obj.pushKV("baseBlockHash", baseBlockHash.ToString());
obj.pushKV("blockHash", blockHash.ToString()); obj.pushKV("blockHash", blockHash.ToString());
@ -207,7 +207,6 @@ void CSimplifiedMNListDiff::ToJson(UniValue& obj, bool extended) const
mnListArr.push_back(eObj); mnListArr.push_back(eObj);
} }
obj.pushKV("mnList", mnListArr); obj.pushKV("mnList", mnListArr);
obj.pushKV("nVersion", nVersion);
UniValue deletedQuorumsArr(UniValue::VARR); UniValue deletedQuorumsArr(UniValue::VARR);
for (const auto& e : deletedQuorums) { for (const auto& e : deletedQuorums) {