Browse Source

Remove GetTotalBlocksEstimate and checkpoint tests that test nothing.

GetTotalBlocksEstimate is no longer used and it was the only thing
 the checkpoint tests were testing.

Since checkpoints are on their way out it makes more sense to remove
 the test file than to cook up a new pointless test.
0.14
Gregory Maxwell 8 years ago
parent
commit
2082b5574c
  1. 1
      src/Makefile.test.include
  2. 10
      src/checkpoints.cpp
  3. 3
      src/checkpoints.h
  4. 27
      src/test/Checkpoints_tests.cpp

1
src/Makefile.test.include

@ -50,7 +50,6 @@ BITCOIN_TESTS =\ @@ -50,7 +50,6 @@ BITCOIN_TESTS =\
test/bip32_tests.cpp \
test/blockencodings_tests.cpp \
test/bloom_tests.cpp \
test/Checkpoints_tests.cpp \
test/coins_tests.cpp \
test/compress_tests.cpp \
test/crypto_tests.cpp \

10
src/checkpoints.cpp

@ -55,16 +55,6 @@ namespace Checkpoints { @@ -55,16 +55,6 @@ namespace Checkpoints {
return fWorkBefore / (fWorkBefore + fWorkAfter);
}
int GetTotalBlocksEstimate(const CCheckpointData& data)
{
const MapCheckpoints& checkpoints = data.mapCheckpoints;
if (checkpoints.empty())
return 0;
return checkpoints.rbegin()->first;
}
CBlockIndex* GetLastCheckpoint(const CCheckpointData& data)
{
const MapCheckpoints& checkpoints = data.mapCheckpoints;

3
src/checkpoints.h

@ -19,9 +19,6 @@ struct CCheckpointData; @@ -19,9 +19,6 @@ struct CCheckpointData;
namespace Checkpoints
{
//! Return conservative estimate of total number of blocks, 0 if unknown
int GetTotalBlocksEstimate(const CCheckpointData& data);
//! Returns last CBlockIndex* in mapBlockIndex that is a checkpoint
CBlockIndex* GetLastCheckpoint(const CCheckpointData& data);

27
src/test/Checkpoints_tests.cpp

@ -1,27 +0,0 @@ @@ -1,27 +0,0 @@
// Copyright (c) 2011-2015 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
//
// Unit tests for block-chain checkpoints
//
#include "checkpoints.h"
#include "uint256.h"
#include "test/test_bitcoin.h"
#include "chainparams.h"
#include <boost/test/unit_test.hpp>
using namespace std;
BOOST_FIXTURE_TEST_SUITE(Checkpoints_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(sanity)
{
const CCheckpointData& checkpoints = Params(CBaseChainParams::MAIN).Checkpoints();
BOOST_CHECK(Checkpoints::GetTotalBlocksEstimate(checkpoints) >= 134444);
}
BOOST_AUTO_TEST_SUITE_END()
Loading…
Cancel
Save