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

Extract finalization state storage #634

Merged
merged 14 commits into from
Feb 24, 2019
1 change: 1 addition & 0 deletions contrib/devtools/lint-clang-format.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def main(argv):
autogitadd = autoformat and "--git-add" in argv
iscurrentcommit = "--check-commit" in argv
dirs = [
"src/finalization",
"src/esperanza",
"src/key",
"src/p2p",
Expand Down
2 changes: 2 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ UNITE_CORE_H = \
esperanza/walletstate.h \
extkey.h \
finalization/p2p.h \
finalization/state_storage.h \
finalization/vote_recorder.h \
fixed_vector.h \
fs.h \
Expand Down Expand Up @@ -290,6 +291,7 @@ libunite_server_a_SOURCES = \
esperanza/finalizationstate.cpp \
esperanza/validator.cpp \
finalization/p2p.cpp \
finalization/state_storage.cpp \
finalization/vote_recorder.cpp \
httprpc.cpp \
httpserver.cpp \
Expand Down
6 changes: 6 additions & 0 deletions src/esperanza/adminstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,10 @@ const AdminParams &AdminState::GetParams() const {
return m_adminParams;
}

bool AdminState::operator==(const AdminState &other) const {
return m_adminPubKeys == other.m_adminPubKeys &&
m_whiteList == other.m_whiteList &&
m_permissioningIsActive == other.m_permissioningIsActive;
}

} // namespace esperanza
1 change: 1 addition & 0 deletions src/esperanza/adminstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class AdminState {
void EndPermissioning();
bool IsPermissioningActive() const;
const AdminParams &GetParams() const;
bool operator==(const AdminState &other) const;
};

} // namespace esperanza
Expand Down
10 changes: 10 additions & 0 deletions src/esperanza/checkpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,14 @@ uint64_t Checkpoint::GetPrevDynastyVotes(uint32_t epoch) {
return pair.first->second;
}

bool Checkpoint::operator==(const Checkpoint &other) const {
return m_isJustified == other.m_isJustified &&
m_isFinalized == other.m_isFinalized &&
m_curDynastyDeposits == other.m_curDynastyDeposits &&
m_prevDynastyDeposits == other.m_prevDynastyDeposits &&
m_curDynastyVotes == other.m_curDynastyVotes &&
m_prevDynastyVotes == other.m_prevDynastyVotes &&
m_voteSet == other.m_voteSet;
}

} // namespace esperanza
2 changes: 2 additions & 0 deletions src/esperanza/checkpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class Checkpoint {

uint64_t GetCurDynastyVotes(uint32_t epoch);
uint64_t GetPrevDynastyVotes(uint32_t epoch);

bool operator==(const Checkpoint &other) const;
};

} // namespace esperanza
Expand Down
Loading