Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move CDeterministicMN class members above functions #5341

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/evo/deterministicmns.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ class CDeterministicMN
static constexpr uint16_t CURRENT_MN_FORMAT = 0;
static constexpr uint16_t MN_TYPE_FORMAT = 1;

uint256 proTxHash;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why they are still public and not const?
I don't mind if move it above (it's fine), but touching them and still keeping them public and non-const... It doesn't look. Any code outside can easily change these data inside CDeterministicMN and make them inconsistent.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@knst well no because we use CDeterministicMNCPtr (which is a std::shared_ptr<const CDeterministicMN>)

COutPoint collateralOutpoint;
uint16_t nOperatorReward{0};
MnType nType{MnType::Regular};
std::shared_ptr<const CDeterministicMNState> pdmnState;

CDeterministicMN() = delete; // no default constructor, must specify internalId
explicit CDeterministicMN(uint64_t _internalId, MnType mnType = MnType::Regular) :
internalId(_internalId),
Expand All @@ -61,12 +67,6 @@ class CDeterministicMN
SerializationOp(s, CSerActionUnserialize(), format_version);
}

uint256 proTxHash;
COutPoint collateralOutpoint;
uint16_t nOperatorReward{0};
MnType nType{MnType::Regular};
std::shared_ptr<const CDeterministicMNState> pdmnState;

template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, const uint8_t format_version)
{
Expand Down