Skip to content

Commit

Permalink
Add unit tests for DIP3 and DIP4
Browse files Browse the repository at this point in the history
  • Loading branch information
codablock committed Sep 5, 2018
1 parent d653ace commit bc7924d
Show file tree
Hide file tree
Showing 6 changed files with 480 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ BITCOIN_TESTS =\
test/crypto_tests.cpp \
test/cuckoocache_tests.cpp \
test/DoS_tests.cpp \
test/evo_deterministicmns_tests.cpp \
test/evo_simplifiedmns_tests.cpp \
test/getarg_tests.cpp \
test/governance_validators_tests.cpp \
test/hash_tests.cpp \
Expand Down
9 changes: 9 additions & 0 deletions src/evo/simplifiedmns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ void CSimplifiedMNListEntry::ToJson(UniValue& obj) const
obj.push_back(Pair("isValid", isValid));
}

CSimplifiedMNList::CSimplifiedMNList(const std::vector<CSimplifiedMNListEntry>& smlEntries)
{
mnList = smlEntries;

std::sort(mnList.begin(), mnList.end(), [&](const CSimplifiedMNListEntry& a, const CSimplifiedMNListEntry& b) {
return a.proRegTxHash.Compare(b.proRegTxHash) < 0;
});
}

CSimplifiedMNList::CSimplifiedMNList(const CDeterministicMNList& dmnList)
{
mnList.reserve(dmnList.all_count());
Expand Down
1 change: 1 addition & 0 deletions src/evo/simplifiedmns.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class CSimplifiedMNList

public:
CSimplifiedMNList() {}
CSimplifiedMNList(const std::vector<CSimplifiedMNListEntry>& smlEntries);
CSimplifiedMNList(const CDeterministicMNList& dmnList);

uint256 CalcMerkleRoot(bool *pmutated = NULL) const;
Expand Down
Loading

0 comments on commit bc7924d

Please sign in to comment.