diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-05-06 11:33:51 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-05-06 11:38:39 +0200 |
commit | 00820f921d8fcaa031e561ee641c50e77a909670 (patch) | |
tree | 2c7ebfed408c68a504ccda70e552bcb9600b6ae2 /src/test | |
parent | 40f5e8dc2ab17b34b24ee6e0391e18ae7065cff9 (diff) | |
parent | a8cdaf5c962ff9018e2d8411f532eec7355f0623 (diff) |
Merge pull request #6055
a8cdaf5 checkpoints: move the checkpoints enable boolean into main (Cory Fields)
11982d3 checkpoints: Decouple checkpoints from Params (Cory Fields)
6996823 checkpoints: make checkpoints a member of CChainParams (Cory Fields)
9f13a10 checkpoints: store mapCheckpoints in CCheckpointData rather than a pointer (Cory Fields)
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/Checkpoints_tests.cpp | 16 | ||||
-rw-r--r-- | src/test/miner_tests.cpp | 4 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/test/Checkpoints_tests.cpp b/src/test/Checkpoints_tests.cpp index c3125d76dc..642ce13bcd 100644 --- a/src/test/Checkpoints_tests.cpp +++ b/src/test/Checkpoints_tests.cpp @@ -10,6 +10,7 @@ #include "uint256.h" #include "test/test_bitcoin.h" +#include "chainparams.h" #include <boost/test/unit_test.hpp> @@ -19,21 +20,22 @@ BOOST_FIXTURE_TEST_SUITE(Checkpoints_tests, BasicTestingSetup) BOOST_AUTO_TEST_CASE(sanity) { + const Checkpoints::CCheckpointData& checkpoints = Params(CBaseChainParams::MAIN).Checkpoints(); uint256 p11111 = uint256S("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"); uint256 p134444 = uint256S("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe"); - BOOST_CHECK(Checkpoints::CheckBlock(11111, p11111)); - BOOST_CHECK(Checkpoints::CheckBlock(134444, p134444)); + BOOST_CHECK(Checkpoints::CheckBlock(checkpoints, 11111, p11111)); + BOOST_CHECK(Checkpoints::CheckBlock(checkpoints, 134444, p134444)); // Wrong hashes at checkpoints should fail: - BOOST_CHECK(!Checkpoints::CheckBlock(11111, p134444)); - BOOST_CHECK(!Checkpoints::CheckBlock(134444, p11111)); + BOOST_CHECK(!Checkpoints::CheckBlock(checkpoints, 11111, p134444)); + BOOST_CHECK(!Checkpoints::CheckBlock(checkpoints, 134444, p11111)); // ... but any hash not at a checkpoint should succeed: - BOOST_CHECK(Checkpoints::CheckBlock(11111+1, p134444)); - BOOST_CHECK(Checkpoints::CheckBlock(134444+1, p11111)); + BOOST_CHECK(Checkpoints::CheckBlock(checkpoints, 11111+1, p134444)); + BOOST_CHECK(Checkpoints::CheckBlock(checkpoints, 134444+1, p11111)); - BOOST_CHECK(Checkpoints::GetTotalBlocksEstimate() >= 134444); + BOOST_CHECK(Checkpoints::GetTotalBlocksEstimate(checkpoints) >= 134444); } BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp index 6ab9cb8a44..d7ea91607c 100644 --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -59,7 +59,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) uint256 hash; LOCK(cs_main); - Checkpoints::fEnabled = false; + fCheckpointsEnabled = false; // Simple block creation, nothing special yet: BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey)); @@ -262,7 +262,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) BOOST_FOREACH(CTransaction *tx, txFirst) delete tx; - Checkpoints::fEnabled = true; + fCheckpointsEnabled = true; } BOOST_AUTO_TEST_SUITE_END() |