Skip to content

Commit 03ec604

Browse files
committed
fix: correct simplifiedmns_merkleroots unit test
In the next commit, we are going to enforce validation the moment we to set values. That will break this test because this test makes two errors. - It tries to use non-mainnet ports on BasicTestingSetup (which is mainnet), resolved by using RegTest. - It constructs the IP 0.0.0.0, which is not a routable address, resolved by counting from 1 onwards.
1 parent bac4a27 commit 03ec604

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/test/evo_simplifiedmns_tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
#include <boost/test/unit_test.hpp>
1212

13-
BOOST_FIXTURE_TEST_SUITE(evo_simplifiedmns_tests, BasicTestingSetup)
13+
BOOST_FIXTURE_TEST_SUITE(evo_simplifiedmns_tests, RegTestingSetup)
1414

1515
BOOST_AUTO_TEST_CASE(simplifiedmns_merkleroots)
1616
{
1717
//TODO: Provide raw data for basic scheme as well
1818
bls::bls_legacy_scheme.store(true);
1919
std::vector<CSimplifiedMNListEntry> entries;
20-
for (size_t i = 0; i < 15; i++) {
20+
for (size_t i = 1; i < 16; i++) {
2121
CSimplifiedMNListEntry smle;
2222
smle.proRegTxHash.SetHex(strprintf("%064x", i));
2323
smle.confirmedHash.SetHex(strprintf("%064x", i));
@@ -35,7 +35,6 @@ BOOST_AUTO_TEST_CASE(simplifiedmns_merkleroots)
3535
}
3636

3737
std::vector<std::string> expectedHashes = {
38-
"373b549f6380d8f7b04d7b04d7c58a749c5cbe3bf41536785ba819879c4870f1",
3938
"3a1010e28226558560e5296bcee6bf0b9b963b73a1514f5aa2885e270f6b90c1",
4039
"85d3d93b28689128daf3a41d706ae5002f447b9b6372776f0ca9d53b31146884",
4140
"8930eee6bd2e7971a7090edfb79f74c00a12280e59adfc2cc99d406a01e368f9",
@@ -50,6 +49,7 @@ BOOST_AUTO_TEST_CASE(simplifiedmns_merkleroots)
5049
"cbc25ca965d0fa69a1fdc1d796b8ee2726a0e2137414e92fb9541630e3189901",
5150
"ac9934c4049ae952d41fb38e7e9659a558a5ce748bdb7fb613741598d1b16a27",
5251
"a61177eb14450bb8c56e5f0547035e0f3a70fe46f36901351cc568b2e48e29d0",
52+
"67798d40a2196f446114c68d86445fe088750515a96eb65392c6bcfac8f3be9b"
5353
};
5454
std::vector<std::string> calculatedHashes;
5555

@@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(simplifiedmns_merkleroots)
6262

6363
CSimplifiedMNList sml(entries);
6464

65-
std::string expectedMerkleRoot = "b2303aca677ae2091c882e44b58f57869fa88a6db1f4e1a5d71975e5387fa195";
65+
std::string expectedMerkleRoot = "0bae2176078cf42fa3e1fda761d4255d1c1c54777c6a793d0ab2b07c85ed4022";
6666
std::string calculatedMerkleRoot = sml.CalcMerkleRoot(nullptr).ToString();
6767
//printf("merkleRoot=\"%s\",\n", calculatedMerkleRoot.c_str());
6868

0 commit comments

Comments
 (0)