From eece63fa72566068cb2a1bf85c95a72a5ba59bc9 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Tue, 17 Nov 2015 17:35:44 +0100 Subject: Switch blocks to a constant-space Merkle root/branch algorithm. This switches the Merkle tree logic for blocks to one that runs in constant (small) space. The old code is moved to tests, and a new test is added that for various combinations of block sizes, transaction positions to compute a branch for, and mutations: * Verifies that the old code and new code agree for the Merkle root. * Verifies that the old code and new code agree for the Merkle branch. * Verifies that the computed Merkle branch is valid. * Verifies that mutations don't change the Merkle root. * Verifies that mutations are correctly detected. --- src/test/main_tests.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/test/main_tests.cpp') diff --git a/src/test/main_tests.cpp b/src/test/main_tests.cpp index 21ae46d6e..2b92d239e 100644 --- a/src/test/main_tests.cpp +++ b/src/test/main_tests.cpp @@ -72,5 +72,4 @@ BOOST_AUTO_TEST_CASE(test_combiner_all) Test.disconnect(&ReturnTrue); BOOST_CHECK(Test()); } - BOOST_AUTO_TEST_SUITE_END() -- cgit v1.2.3 From fa24439ff3d8ab5b9efaf66ef4dae6713b88cb35 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Sun, 13 Dec 2015 17:58:29 +0100 Subject: Bump copyright headers to 2015 --- src/test/main_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/test/main_tests.cpp') diff --git a/src/test/main_tests.cpp b/src/test/main_tests.cpp index 2b92d239e..dbfbdd934 100644 --- a/src/test/main_tests.cpp +++ b/src/test/main_tests.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014 The Bitcoin Core developers +// Copyright (c) 2014-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. -- cgit v1.2.3 From e736772c56a883e2649cc8534dd7857a0718ec56 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 1 Dec 2016 15:45:50 -0800 Subject: Move network-msg-processing code out of main to its own file --- src/test/main_tests.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/test/main_tests.cpp') diff --git a/src/test/main_tests.cpp b/src/test/main_tests.cpp index dbfbdd934..1942fefce 100644 --- a/src/test/main_tests.cpp +++ b/src/test/main_tests.cpp @@ -4,6 +4,7 @@ #include "chainparams.h" #include "main.h" +#include "net.h" #include "test/test_bitcoin.h" -- cgit v1.2.3 From 76faa3cdfedbd3fc91be4ecfff77fc6dc18134fb Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 1 Dec 2016 16:06:41 -0800 Subject: Rename the remaining main.{h,cpp} to validation.{h,cpp} --- src/test/main_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/test/main_tests.cpp') diff --git a/src/test/main_tests.cpp b/src/test/main_tests.cpp index 1942fefce..697fbf792 100644 --- a/src/test/main_tests.cpp +++ b/src/test/main_tests.cpp @@ -3,7 +3,7 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "chainparams.h" -#include "main.h" +#include "validation.h" #include "net.h" #include "test/test_bitcoin.h" -- cgit v1.2.3 From 27765b6403cece54320374b37afb01a0cfe571c3 Mon Sep 17 00:00:00 2001 From: isle2983 Date: Sat, 31 Dec 2016 11:01:21 -0700 Subject: Increment MIT Licence copyright header year on files modified in 2016 Edited via: $ contrib/devtools/copyright_header.py update . --- src/test/main_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/test/main_tests.cpp') diff --git a/src/test/main_tests.cpp b/src/test/main_tests.cpp index 697fbf792..d52104b4c 100644 --- a/src/test/main_tests.cpp +++ b/src/test/main_tests.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2015 The Bitcoin Core developers +// Copyright (c) 2014-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -- cgit v1.2.3 From 3cff8e9773332283a5471771edcdbd1fd9a07b21 Mon Sep 17 00:00:00 2001 From: Ross Nicoll Date: Tue, 18 Apr 2017 16:52:01 +0100 Subject: Replace test data with Dogecoin values Replace test data with Dogecoin equivalents in the folowing tests: * base58 * bip32 * keys * miner * pow Replace RPC and deterministic signatures in unit tests with Dogecoin values. While conventionally I'd use an alternative implementation for these, as RFC 6979 compliant signature generation isn't terribly common, and there's no reason to suspect we've modified this code, I'm going to assert that it's good enough to test that the code doesn't provide different values. Disabled Bitcoin PoW tests, but left code in place to simplify later merges. These are replaced by the Dogecoin PoW tests. --- src/test/main_tests.cpp | 58 ++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 27 deletions(-) (limited to 'src/test/main_tests.cpp') diff --git a/src/test/main_tests.cpp b/src/test/main_tests.cpp index d52104b4c..143c63243 100644 --- a/src/test/main_tests.cpp +++ b/src/test/main_tests.cpp @@ -15,46 +15,50 @@ BOOST_FIXTURE_TEST_SUITE(main_tests, TestingSetup) static void TestBlockSubsidyHalvings(const Consensus::Params& consensusParams) { - int maxHalvings = 64; - CAmount nInitialSubsidy = 50 * COIN; + // tested in dogecoin_tests.cpp + //int maxHalvings = 64; + //CAmount nInitialSubsidy = 50 * COIN; - CAmount nPreviousSubsidy = nInitialSubsidy * 2; // for height == 0 - BOOST_CHECK_EQUAL(nPreviousSubsidy, nInitialSubsidy * 2); - for (int nHalvings = 0; nHalvings < maxHalvings; nHalvings++) { - int nHeight = nHalvings * consensusParams.nSubsidyHalvingInterval; - CAmount nSubsidy = GetBlockSubsidy(nHeight, consensusParams); - BOOST_CHECK(nSubsidy <= nInitialSubsidy); - BOOST_CHECK_EQUAL(nSubsidy, nPreviousSubsidy / 2); - nPreviousSubsidy = nSubsidy; - } - BOOST_CHECK_EQUAL(GetBlockSubsidy(maxHalvings * consensusParams.nSubsidyHalvingInterval, consensusParams), 0); + //CAmount nPreviousSubsidy = nInitialSubsidy * 2; // for height == 0 + //BOOST_CHECK_EQUAL(nPreviousSubsidy, nInitialSubsidy * 2); + //for (int nHalvings = 0; nHalvings < maxHalvings; nHalvings++) { + // int nHeight = nHalvings * consensusParams.nSubsidyHalvingInterval; + // CAmount nSubsidy = GetBlockSubsidy(nHeight, consensusParams); + // BOOST_CHECK(nSubsidy <= nInitialSubsidy); + // BOOST_CHECK_EQUAL(nSubsidy, nPreviousSubsidy / 2); + // nPreviousSubsidy = nSubsidy; + //} + //BOOST_CHECK_EQUAL(GetBlockSubsidy(maxHalvings * consensusParams.nSubsidyHalvingInterval, consensusParams), 0); } static void TestBlockSubsidyHalvings(int nSubsidyHalvingInterval) { - Consensus::Params consensusParams; - consensusParams.nSubsidyHalvingInterval = nSubsidyHalvingInterval; - TestBlockSubsidyHalvings(consensusParams); + // tested in dogecoin_tests.cpp + //Consensus::Params consensusParams; + //consensusParams.nSubsidyHalvingInterval = nSubsidyHalvingInterval; + //TestBlockSubsidyHalvings(consensusParams); } BOOST_AUTO_TEST_CASE(block_subsidy_test) { - TestBlockSubsidyHalvings(Params(CBaseChainParams::MAIN).GetConsensus()); // As in main - TestBlockSubsidyHalvings(150); // As in regtest - TestBlockSubsidyHalvings(1000); // Just another interval + // tested in dogecoin_tests.cpp + //TestBlockSubsidyHalvings(Params(CBaseChainParams::MAIN).GetConsensus()); // As in main + //TestBlockSubsidyHalvings(150); // As in regtest + //TestBlockSubsidyHalvings(1000); // Just another interval } BOOST_AUTO_TEST_CASE(subsidy_limit_test) { - const Consensus::Params& consensusParams = Params(CBaseChainParams::MAIN).GetConsensus(); - CAmount nSum = 0; - for (int nHeight = 0; nHeight < 14000000; nHeight += 1000) { - CAmount nSubsidy = GetBlockSubsidy(nHeight, consensusParams); - BOOST_CHECK(nSubsidy <= 50 * COIN); - nSum += nSubsidy * 1000; - BOOST_CHECK(MoneyRange(nSum)); - } - BOOST_CHECK_EQUAL(nSum, 2099999997690000ULL); + // tested in dogecoin_tests.cpp + //const Consensus::Params& consensusParams = Params(CBaseChainParams::MAIN).GetConsensus(); + //CAmount nSum = 0; + //for (int nHeight = 0; nHeight < 14000000; nHeight += 1000) { + // CAmount nSubsidy = GetBlockSubsidy(nHeight, consensusParams); + // BOOST_CHECK(nSubsidy <= 50 * COIN); + // nSum += nSubsidy * 1000; + // BOOST_CHECK(MoneyRange(nSum)); + //} + //BOOST_CHECK_EQUAL(nSum, 2099999997690000ULL); } bool ReturnFalse() { return false; } -- cgit v1.2.3