Fix tests

Closes #711
This commit is contained in:
UdjinM6 2016-03-03 22:20:32 +03:00 committed by Holger Schinzel
parent 9a52925d5c
commit 3ad675aadb
58 changed files with 162 additions and 161 deletions

View File

@ -78,7 +78,7 @@ BITCOIN_TESTS =\
test/skiplist_tests.cpp \
test/streams_tests.cpp \
test/test_dash.cpp \
test/test_bitcoin.h \
test/test_dash.h \
test/timedata_tests.cpp \
test/transaction_tests.cpp \
test/txvalidationcache_tests.cpp \

View File

@ -2132,7 +2132,7 @@ void PartitionCheck(bool (*initialDownloadCheck)(), CCriticalSection& cs, const
int64_t now = GetAdjustedTime();
if (lastAlertTime > now-60*60*24) return; // Alert at most once per day
const int SPAN_HOURS=4;
const int SPAN_HOURS=1; // was 4h in bitcoin but we have 4x faster blocks
const int SPAN_SECONDS=SPAN_HOURS*60*60;
int BLOCKS_EXPECTED = SPAN_SECONDS / nPowTargetSpacing;

View File

@ -9,7 +9,7 @@
#include "checkpoints.h"
#include "uint256.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include "chainparams.h"
#include <boost/test/unit_test.hpp>

View File

@ -13,7 +13,7 @@
#include "serialize.h"
#include "util.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <stdint.h>

View File

@ -22,14 +22,14 @@ For further reading, I found the following website to be helpful in
explaining how the boost unit test framework works:
[http://www.alittlemadness.com/2009/03/31/c-unit-testing-with-boosttest/](http://www.alittlemadness.com/2009/03/31/c-unit-testing-with-boosttest/).
test_bitcoin has some built-in command-line arguments; for
test_dash has some built-in command-line arguments; for
example, to run just the getarg_tests verbosely:
test_bitcoin --log_level=all --run_test=getarg_tests
test_dash --log_level=all --run_test=getarg_tests
... or to run just the doubledash test:
test_bitcoin --run_test=getarg_tests/doubledash
test_dash --run_test=getarg_tests/doubledash
Run test_bitcoin --help for the full list.
Run test_dash --help for the full list.

View File

@ -5,7 +5,7 @@
#include "wallet/wallet.h"
#include "wallet/walletdb.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <stdint.h>

View File

@ -2,7 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "addrman.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <string>
#include <boost/test/unit_test.hpp>

View File

@ -15,7 +15,7 @@
#include "util.h"
#include "utilstrencodings.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <fstream>
@ -224,8 +224,8 @@ BOOST_AUTO_TEST_CASE(PartitionAlert)
PartitionCheck(falseFunc, csDummy, &indexDummy[99], nPowTargetSpacing);
BOOST_CHECK_MESSAGE(strMiscWarning.empty(), strMiscWarning);
// Test 2: go 3.5 hours without a block, expect a warning:
now += 3*60*60+30*60;
// Test 2: go 52.5 minutes without a block, expect a warning:
now += (3*60*60+30*60)/4; // we have 4x faster blocks
SetMockTime(now);
PartitionCheck(falseFunc, csDummy, &indexDummy[99], nPowTargetSpacing);
BOOST_CHECK(!strMiscWarning.empty());

View File

@ -5,7 +5,7 @@
#include "util.h"
#include "support/allocators/secure.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/test/unit_test.hpp>

View File

@ -12,7 +12,7 @@
#include "arith_uint256.h"
#include <string>
#include "version.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
BOOST_FIXTURE_TEST_SUITE(arith_uint256_tests, BasicTestingSetup)

View File

@ -3,7 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "utilstrencodings.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/test/unit_test.hpp>

View File

@ -13,7 +13,7 @@
#include "uint256.h"
#include "util.h"
#include "utilstrencodings.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/foreach.hpp>
#include <boost/test/unit_test.hpp>

View File

@ -3,7 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "utilstrencodings.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/test/unit_test.hpp>

View File

@ -9,7 +9,7 @@
#include "uint256.h"
#include "util.h"
#include "utilstrencodings.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <string>
#include <vector>
@ -38,44 +38,44 @@ struct TestVector {
TestVector test1 =
TestVector("000102030405060708090a0b0c0d0e0f")
("xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8",
"xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi",
("drkvjJe5sJgqomjLo3qGVgD8fcPo43UZPgaaskFEjpgSzpwfyEji7NK1mrdUUC1rtqdST6MW4eFxxt1328RR312x9XZsZUAxNo7pTssukwBT5Tx",
"drkpRsmwKURS9g8uDqs1tGTJwh16JHZ27Q49iCXHQ2rD7fFVix4LRp47wHSYAFD8cPPSNoonYypuVXbPig9vkyTtxX3CoeF6B4KB9ozvafgNEj8",
0x80000000)
("xpub68Gmy5EdvgibQVfPdqkBBCHxA5htiqg55crXYuXoQRKfDBFA1WEjWgP6LHhwBZeNK1VTsfTFUHCdrfp1bgwQ9xv5ski8PX9rL2dZXvgGDnw",
"xprv9uHRZZhk6KAJC1avXpDAp4MDc3sQKNxDiPvvkX8Br5ngLNv1TxvUxt4cV1rGL5hj6KCesnDYUhd7oWgT11eZG7XnxHrnYeSvkzY7d2bhkJ7",
("drkvjLuVs1zJu2rKwexyhS5mYeVuNs2umm4bZMg8hv4Zy28xLX2tXbr6tzytFTaZe9XyTJe4vsoPhX57zXPYz2mLDR2bm6yDJ722yp1U4adNnEx",
"drkpRv3MKBiuEwFtNSzj62Kwpj7Cd77NVUYAPoxBN8EL5rSn6EMWr3bD4RnwwWZU26mQ5rhUvH9mstSGSSBeQZk5kb7isWvER224rpdn1q7ivwn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LsEd4Hsb2Tyh8RfQMuPh7f7RtyzTtdrbdqqsunu5Mm3wDvUAKRHSC34sJ7in334",
("drkvjTvHwmV1B6FnikHENYb6Ptb1kDBGfvh5GhTwoUf1PxsDM1MW7voCxatxttDMukqNErV2Tgi4Eo2gbacfFkuxg7UdYzLPgsypLvNEbN6fekp",
"drkpS349PwDbWzfM9YJym8qGfyCJzTFjPeAe79jzTgpmWoB36ig8SNYK81i2avNc3vTN7CcFwUvhHpfkGmM5KLzbrEds99XcBnraHsAXgmc3EUv",
1000000000)
("xpub6H1LXWLaKsWFhvm6RVpEL9P4KfRZSW7abD2ttkWP3SSQvnyA8FSVqNTEcYFgJS2UaFcxupHiYkro49S8yGasTvXEYBVPamhGW6cFJodrTHy",
"xprvA41z7zogVVwxVSgdKUHDy1SKmdb533PjDz7J6N6mV6uS3ze1ai8FHa8kmHScGpWmj4WggLyQjgPie1rFSruoUihUZREPSL39UNdE3BBDu76",
("drkvjVe4RT6FJDdzF64gV69phbb1YSkaVRW74wrW3m39c3Fi48kteM3sDh42Xi8Jm1v5iYmZy2drmzjHC11gMcQoXNdkRXkUVMZT9sz9qZGZMZH",
"drkpS4muscpqe83Yft6RsgPzygCJngq3D8yfuQ8YhyCuisZXor5WxnnyP7s6Dn9oxqaSic1Wique8sCsGwMSrR1KyCHQUeHqJhcHaCitRvHHSKf",
0);
TestVector test2 =
TestVector("fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a29f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542")
("xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB",
"xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pGz6ssrdK4PFmM8NSpSBHNqPqm55Qn3LqFtT2emdEXVYsCzC2U",
("drkvj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y3bdW6EEgAtqt",
"xprvA2nrNbFZABcdryreWet9Ea4LvTJcGsqrMzxHx98MMrotbir7yrKCEXw7nadnHM8Dq38EGfSh6dqA9QWTyefMLEcBYJUuekgW4BYPJcr9E7j",
("drkvjUQvg3Y7xuJfcdEhgGkjyAD2hGU7jFxECxhVuY4jUoAAbry13VEpAerPYzhmGjBNRAKRQSRqdhRXncvaF8N1e8hfjt5aBZqEFQszktZUYXN",
"drkpS3Yn8DGiJoiE3RGT4rzvFEpKwWYaSyRo3QyYZkEVbdTzMaHdMvyvL5fTF5LyyNBtpad4KANvVpeJnL1fPCkspiC7TXYMX8FeA1e3hMDsE8f",
0);
void RunTest(const TestVector &test) {

View File

@ -14,7 +14,7 @@
#include "uint256.h"
#include "util.h"
#include "utilstrencodings.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <vector>
@ -492,7 +492,7 @@ BOOST_AUTO_TEST_CASE(rolling_bloom)
if (rb1.contains(RandomData()))
++nHits;
}
// Run test_bitcoin with --log_level=message to see BOOST_TEST_MESSAGEs:
// Run test_dash with --log_level=message to see BOOST_TEST_MESSAGEs:
BOOST_TEST_MESSAGE("RollingBloomFilter got " << nHits << " false positives (~100 expected)");
// Insanely unlikely to get a fp count outside this range:

View File

@ -6,7 +6,7 @@
#include "consensus/validation.h"
#include "main.h" // For CheckBlock
#include "primitives/block.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include "utiltime.h"
#include <cstdio>

View File

@ -5,7 +5,7 @@
#include "coins.h"
#include "random.h"
#include "uint256.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include "main.h"
#include "consensus/validation.h"

View File

@ -4,7 +4,7 @@
#include "compressor.h"
#include "util.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <stdint.h>

View File

@ -10,7 +10,7 @@
#include "crypto/hmac_sha512.h"
#include "random.h"
#include "utilstrencodings.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <vector>

View File

@ -57,7 +57,7 @@
"outaddr=0.001:XijDvbYpPmznwgpWD3DkdYNfGmRP2KoVSk"],
"output_cmp": "txcreatesign.hex"
},
{ "exec": "./bitcoin-tx",
{ "exec": "./dash-tx",
"args":
["-create",
"in=4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485:0",
@ -67,21 +67,21 @@
"outaddr=0.001:193P6LtvS4nCnkDvM9uXn1gsSRqh4aDAz7"],
"output_cmp": "txcreatesign.hex"
},
{ "exec": "./bitcoin-tx",
{ "exec": "./dash-tx",
"args":
["-create",
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0",
"outdata=4:badhexdata"],
"return_code": 1
},
{ "exec": "./bitcoin-tx",
{ "exec": "./dash-tx",
"args":
["-create",
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0",
"outdata=badhexdata"],
"return_code": 1
},
{ "exec": "./bitcoin-tx",
{ "exec": "./dash-tx",
"args":
["-create",
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0",
@ -89,7 +89,7 @@
"outdata=4:54686973204f505f52455455524e207472616e73616374696f6e206f7574707574207761732063726561746564206279206d6f646966696564206372656174657261777472616e73616374696f6e2e"],
"output_cmp": "txcreatedata1.hex"
},
{ "exec": "./bitcoin-tx",
{ "exec": "./dash-tx",
"args":
["-create",
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0",

View File

@ -5,7 +5,7 @@
#include "dbwrapper.h"
#include "uint256.h"
#include "random.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/assign/std/vector.hpp> // for 'operator+=()'
#include <boost/assert.hpp>

View File

@ -3,7 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "util.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <string>
#include <vector>

View File

@ -4,7 +4,7 @@
#include "hash.h"
#include "utilstrencodings.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <vector>

View File

@ -9,7 +9,7 @@
#include "uint256.h"
#include "util.h"
#include "utilstrencodings.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <string>
#include <vector>

View File

@ -4,7 +4,7 @@
#include "limitedmap.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/test/unit_test.hpp>

View File

@ -6,7 +6,7 @@
#include "chainparams.h"
#include "main.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/signals2/signal.hpp>
#include <boost/test/unit_test.hpp>

View File

@ -5,7 +5,7 @@
#include "txmempool.h"
#include "util.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/test/unit_test.hpp>
#include <list>

View File

@ -3,7 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "consensus/merkle.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include "random.h"
#include <boost/test/unit_test.hpp>

View File

@ -16,7 +16,7 @@
#include "util.h"
#include "utilstrencodings.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/test/unit_test.hpp>
@ -114,7 +114,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
tx.vin[0].prevout.hash = txFirst[0]->GetHash();
tx.vin[0].prevout.n = 0;
tx.vout.resize(1);
tx.vout[0].nValue = 5000000000LL;
tx.vout[0].nValue = 50000000000LL;
for (unsigned int i = 0; i < 1001; ++i)
{
tx.vout[0].nValue -= 1000000;
@ -128,7 +128,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
mempool.clear();
tx.vin[0].prevout.hash = txFirst[0]->GetHash();
tx.vout[0].nValue = 5000000000LL;
tx.vout[0].nValue = 50000000000LL;
for (unsigned int i = 0; i < 1001; ++i)
{
tx.vout[0].nValue -= 1000000;
@ -150,7 +150,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
tx.vin[0].scriptSig << vchData << OP_DROP;
tx.vin[0].scriptSig << OP_1;
tx.vin[0].prevout.hash = txFirst[0]->GetHash();
tx.vout[0].nValue = 5000000000LL;
tx.vout[0].nValue = 50000000000LL;
for (unsigned int i = 0; i < 128; ++i)
{
tx.vout[0].nValue -= 10000000;
@ -172,17 +172,17 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
// child with higher priority than parent
tx.vin[0].scriptSig = CScript() << OP_1;
tx.vin[0].prevout.hash = txFirst[1]->GetHash();
tx.vout[0].nValue = 4900000000LL;
tx.vout[0].nValue = 49000000000LL;
hash = tx.GetHash();
mempool.addUnchecked(hash, entry.Fee(100000000LL).Time(GetTime()).SpendsCoinbase(true).FromTx(tx));
mempool.addUnchecked(hash, entry.Fee(1000000000LL).Time(GetTime()).SpendsCoinbase(true).FromTx(tx));
tx.vin[0].prevout.hash = hash;
tx.vin.resize(2);
tx.vin[1].scriptSig = CScript() << OP_1;
tx.vin[1].prevout.hash = txFirst[0]->GetHash();
tx.vin[1].prevout.n = 0;
tx.vout[0].nValue = 5900000000LL;
tx.vout[0].nValue = 59000000000LL;
hash = tx.GetHash();
mempool.addUnchecked(hash, entry.Fee(400000000LL).Time(GetTime()).SpendsCoinbase(true).FromTx(tx));
mempool.addUnchecked(hash, entry.Fee(4000000000LL).Time(GetTime()).SpendsCoinbase(true).FromTx(tx));
BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
delete pblocktemplate;
mempool.clear();
@ -202,11 +202,11 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
tx.vin[0].prevout.hash = txFirst[0]->GetHash();
tx.vin[0].prevout.n = 0;
tx.vin[0].scriptSig = CScript() << OP_1;
tx.vout[0].nValue = 4900000000LL;
tx.vout[0].nValue = 49000000000LL;
script = CScript() << OP_0;
tx.vout[0].scriptPubKey = GetScriptForDestination(CScriptID(script));
hash = tx.GetHash();
mempool.addUnchecked(hash, entry.Fee(10000000L).Time(GetTime()).SpendsCoinbase(true).FromTx(tx));
mempool.addUnchecked(hash, entry.Fee(100000000L).Time(GetTime()).SpendsCoinbase(true).FromTx(tx));
tx.vin[0].prevout.hash = hash;
tx.vin[0].scriptSig = CScript() << std::vector<unsigned char>(script.begin(), script.end());
tx.vout[0].nValue -= 1000000;
@ -218,25 +218,25 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
// double spend txn pair in mempool, template creation fails
tx.vin[0].prevout.hash = txFirst[0]->GetHash();
tx.vin[0].scriptSig = CScript() << OP_1;
tx.vout[0].nValue = 4900000000LL;
tx.vout[0].nValue = 49000000000LL;
tx.vout[0].scriptPubKey = CScript() << OP_1;
hash = tx.GetHash();
mempool.addUnchecked(hash, entry.Fee(100000000L).Time(GetTime()).SpendsCoinbase(true).FromTx(tx));
mempool.addUnchecked(hash, entry.Fee(1000000000L).Time(GetTime()).SpendsCoinbase(true).FromTx(tx));
tx.vout[0].scriptPubKey = CScript() << OP_2;
hash = tx.GetHash();
mempool.addUnchecked(hash, entry.Fee(100000000L).Time(GetTime()).SpendsCoinbase(true).FromTx(tx));
mempool.addUnchecked(hash, entry.Fee(1000000000L).Time(GetTime()).SpendsCoinbase(true).FromTx(tx));
BOOST_CHECK_THROW(CreateNewBlock(chainparams, scriptPubKey), std::runtime_error);
mempool.clear();
// subsidy changing
int nHeight = chainActive.Height();
chainActive.Tip()->nHeight = 209999;
BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
delete pblocktemplate;
chainActive.Tip()->nHeight = 210000;
BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
delete pblocktemplate;
chainActive.Tip()->nHeight = nHeight;
// int nHeight = chainActive.Height();
// chainActive.Tip()->nHeight = 209999;
// BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
// delete pblocktemplate;
// chainActive.Tip()->nHeight = 210000;
// BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
// delete pblocktemplate;
// chainActive.Tip()->nHeight = nHeight;
// non-final txs in mempool
SetMockTime(chainActive.Tip()->GetMedianTimePast()+1);
@ -245,11 +245,11 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
tx.vin[0].prevout.hash = txFirst[0]->GetHash();
tx.vin[0].scriptSig = CScript() << OP_1;
tx.vin[0].nSequence = 0;
tx.vout[0].nValue = 4900000000LL;
tx.vout[0].nValue = 49000000000LL;
tx.vout[0].scriptPubKey = CScript() << OP_1;
tx.nLockTime = chainActive.Tip()->nHeight+1;
hash = tx.GetHash();
mempool.addUnchecked(hash, entry.Fee(100000000L).Time(GetTime()).SpendsCoinbase(true).FromTx(tx));
mempool.addUnchecked(hash, entry.Fee(1000000000L).Time(GetTime()).SpendsCoinbase(true).FromTx(tx));
BOOST_CHECK(!CheckFinalTx(tx, LOCKTIME_MEDIAN_TIME_PAST));
// time locked
@ -259,11 +259,11 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
tx2.vin[0].scriptSig = CScript() << OP_1;
tx2.vin[0].nSequence = 0;
tx2.vout.resize(1);
tx2.vout[0].nValue = 4900000000LL;
tx2.vout[0].nValue = 49000000000LL;
tx2.vout[0].scriptPubKey = CScript() << OP_1;
tx2.nLockTime = chainActive.Tip()->GetMedianTimePast()+1;
hash = tx2.GetHash();
mempool.addUnchecked(hash, entry.Fee(100000000L).Time(GetTime()).SpendsCoinbase(true).FromTx(tx2));
mempool.addUnchecked(hash, entry.Fee(1000000000L).Time(GetTime()).SpendsCoinbase(true).FromTx(tx2));
BOOST_CHECK(!CheckFinalTx(tx2, LOCKTIME_MEDIAN_TIME_PAST));
BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));

View File

@ -10,7 +10,7 @@
#include "script/interpreter.h"
#include "script/sign.h"
#include "uint256.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#ifdef ENABLE_WALLET
#include "wallet/wallet_ismine.h"

View File

@ -4,7 +4,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "netbase.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <string>

View File

@ -10,7 +10,7 @@
#include "arith_uint256.h"
#include "version.h"
#include "random.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <vector>

View File

@ -7,7 +7,7 @@
#include "uint256.h"
#include "util.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/test/unit_test.hpp>
@ -15,11 +15,11 @@ BOOST_FIXTURE_TEST_SUITE(policyestimator_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
{
CTxMemPool mpool(CFeeRate(1000));
CTxMemPool mpool(CFeeRate(10000)); // we have 10x higher fee
TestMemPoolEntryHelper entry;
CAmount basefee(2000);
CAmount basefee(20000); // we have 10x higher fee
double basepri = 1e6;
CAmount deltaFee(100);
CAmount deltaFee(1000); // we have 10x higher fee
double deltaPri=5e5;
std::vector<CAmount> feeV[2];
std::vector<double> priV[2];

View File

@ -7,7 +7,7 @@
#include "pow.h"
#include "random.h"
#include "util.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/test/unit_test.hpp>
@ -15,61 +15,62 @@ using namespace std;
BOOST_FIXTURE_TEST_SUITE(pow_tests, BasicTestingSetup)
/* Test calculation of next difficulty target with no constraints applying */
/* Test calculation of next difficulty target with DGW */
BOOST_AUTO_TEST_CASE(get_next_work)
{
SelectParams(CBaseChainParams::MAIN);
const Consensus::Params& params = Params().GetConsensus();
int64_t nLastRetargetTime = 1261130161; // Block #30240
CBlockIndex pindexLast;
pindexLast.nHeight = 32255;
pindexLast.nTime = 1262152739; // Block #32255
pindexLast.nBits = 0x1d00ffff;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d00d86a);
pindexLast.nHeight = 123456;
pindexLast.nTime = 1408732489; // Block #123456
pindexLast.nBits = 0x1b1418d4;
CBlockHeader pblock;
pblock.nTime = 1408732505; // Block #123457
BOOST_CHECK_EQUAL(GetNextWorkRequired(&pindexLast, &pblock, params), 0x1b06b2f1); // Block #123457 has 0x1d00d86a
}
/* Test the constraint on the upper bound for next work */
BOOST_AUTO_TEST_CASE(get_next_work_pow_limit)
{
SelectParams(CBaseChainParams::MAIN);
const Consensus::Params& params = Params().GetConsensus();
// BOOST_AUTO_TEST_CASE(get_next_work_pow_limit)
// {
// SelectParams(CBaseChainParams::MAIN);
// const Consensus::Params& params = Params().GetConsensus();
int64_t nLastRetargetTime = 1231006505; // Block #0
CBlockIndex pindexLast;
pindexLast.nHeight = 2015;
pindexLast.nTime = 1233061996; // Block #2015
pindexLast.nBits = 0x1d00ffff;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d00ffff);
}
// int64_t nLastRetargetTime = 1231006505; // Block #0
// CBlockIndex pindexLast;
// pindexLast.nHeight = 2015;
// pindexLast.nTime = 1233061996; // Block #2015
// pindexLast.nBits = 0x1d00ffff;
// BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d00ffff);
// }
/* Test the constraint on the lower bound for actual time taken */
BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual)
{
SelectParams(CBaseChainParams::MAIN);
const Consensus::Params& params = Params().GetConsensus();
// BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual)
// {
// SelectParams(CBaseChainParams::MAIN);
// const Consensus::Params& params = Params().GetConsensus();
int64_t nLastRetargetTime = 1279008237; // Block #66528
CBlockIndex pindexLast;
pindexLast.nHeight = 68543;
pindexLast.nTime = 1279297671; // Block #68543
pindexLast.nBits = 0x1c05a3f4;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c0168fd);
}
// int64_t nLastRetargetTime = 1279008237; // Block #66528
// CBlockIndex pindexLast;
// pindexLast.nHeight = 68543;
// pindexLast.nTime = 1279297671; // Block #68543
// pindexLast.nBits = 0x1c05a3f4;
// BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c0168fd);
// }
/* Test the constraint on the upper bound for actual time taken */
BOOST_AUTO_TEST_CASE(get_next_work_upper_limit_actual)
{
SelectParams(CBaseChainParams::MAIN);
const Consensus::Params& params = Params().GetConsensus();
// BOOST_AUTO_TEST_CASE(get_next_work_upper_limit_actual)
// {
// SelectParams(CBaseChainParams::MAIN);
// const Consensus::Params& params = Params().GetConsensus();
int64_t nLastRetargetTime = 1263163443; // NOTE: Not an actual block time
CBlockIndex pindexLast;
pindexLast.nHeight = 46367;
pindexLast.nTime = 1269211443; // Block #46367
pindexLast.nBits = 0x1c387f6f;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d00e1fd);
}
// int64_t nLastRetargetTime = 1263163443; // NOTE: Not an actual block time
// CBlockIndex pindexLast;
// pindexLast.nHeight = 46367;
// pindexLast.nTime = 1269211443; // Block #46367
// pindexLast.nBits = 0x1c387f6f;
// BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d00e1fd);
// }
BOOST_AUTO_TEST_CASE(GetBlockProofEquivalentTime_test)
{

View File

@ -9,7 +9,7 @@
#include "serialize.h"
#include "streams.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/test/unit_test.hpp>

View File

@ -3,7 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "reverselock.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/test/unit_test.hpp>

View File

@ -8,7 +8,7 @@
#include "base58.h"
#include "netbase.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/algorithm/string.hpp>
#include <boost/test/unit_test.hpp>

View File

@ -9,7 +9,7 @@
#include "main.h"
#include "wallet/wallet.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/algorithm/string.hpp>
#include <boost/test/unit_test.hpp>

View File

@ -4,7 +4,7 @@
#include "compat/sanity.h"
#include "key.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/test/unit_test.hpp>

View File

@ -5,7 +5,7 @@
#include "random.h"
#include "scheduler.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/bind.hpp>
#include <boost/random/mersenne_twister.hpp>

View File

@ -9,7 +9,7 @@
#include "script/script.h"
#include "script/script_error.h"
#include "script/sign.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#ifdef ENABLE_WALLET
#include "wallet/wallet_ismine.h"

View File

@ -13,7 +13,7 @@
#include "script/sign.h"
#include "util.h"
#include "utilstrencodings.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#if defined(HAVE_CONSENSUS_LIB)
#include "script/bitcoinconsensus.h"

View File

@ -4,7 +4,7 @@
#include "scriptnum10.h"
#include "script/script.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/test/unit_test.hpp>
#include <limits.h>

View File

@ -5,7 +5,7 @@
#include "serialize.h"
#include "streams.h"
#include "hash.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <stdint.h>

View File

@ -11,7 +11,7 @@
#include "script/script.h"
#include "serialize.h"
#include "streams.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include "util.h"
#include "utilstrencodings.h"
#include "version.h"

View File

@ -7,7 +7,7 @@
#include "script/script.h"
#include "script/standard.h"
#include "uint256.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <vector>

View File

@ -5,7 +5,7 @@
#include "chain.h"
#include "random.h"
#include "util.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <vector>

View File

@ -4,7 +4,7 @@
#include "streams.h"
#include "support/allocators/zeroafterfree.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/assign/std/vector.hpp> // for 'operator+=()'
#include <boost/assert.hpp>

View File

@ -4,7 +4,7 @@
#define BOOST_TEST_MODULE Dash Test Suite
#include "test_bitcoin.h"
#include "test_dash.h"
#include "chainparams.h"
#include "consensus/consensus.h"

View File

@ -1,5 +1,5 @@
#ifndef BITCOIN_TEST_TEST_BITCOIN_H
#define BITCOIN_TEST_TEST_BITCOIN_H
#ifndef BITCOIN_TEST_TEST_DASH_H
#define BITCOIN_TEST_TEST_DASH_H
#include "chainparamsbase.h"
#include "key.h"

View File

@ -3,7 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
//
#include "timedata.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/test/unit_test.hpp>

View File

@ -4,7 +4,7 @@
#include "data/tx_invalid.json.h"
#include "data/tx_valid.json.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include "clientversion.h"
#include "consensus/validation.h"
@ -348,10 +348,10 @@ BOOST_AUTO_TEST_CASE(test_IsStandard)
// nDustThreshold = 182 * 12340 / 1000 * 3
minRelayTxFee = CFeeRate(12340);
// dust:
t.vout[0].nValue = 6720 - 1;
t.vout[0].nValue = 6735 - 1;
BOOST_CHECK(!IsStandardTx(t, reason));
// not dust:
t.vout[0].nValue = 6720;
t.vout[0].nValue = 6735;
BOOST_CHECK(IsStandardTx(t, reason));
minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);

View File

@ -10,7 +10,7 @@
#include "txmempool.h"
#include "random.h"
#include "script/standard.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include "utiltime.h"
#include <boost/test/unit_test.hpp>

View File

@ -4,7 +4,7 @@
#include "arith_uint256.h"
#include "uint256.h"
#include "version.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/test/unit_test.hpp>
#include <stdint.h>

View File

@ -7,7 +7,7 @@
#include <string>
#include <map>
#include <univalue.h>
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/test/unit_test.hpp>

View File

@ -10,7 +10,7 @@
#include "sync.h"
#include "utilstrencodings.h"
#include "utilmoneystr.h"
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <stdint.h>
#include <vector>

View File

@ -22,7 +22,7 @@ class CAutoFile;
inline double AllowFreeThreshold()
{
return COIN * 576 / 250;
return COIN * 144 / 250;
}
inline bool AllowFree(double dPriority)

View File

@ -9,7 +9,7 @@
#include <utility>
#include <vector>
#include "test/test_bitcoin.h"
#include "test/test_dash.h"
#include <boost/foreach.hpp>
#include <boost/test/unit_test.hpp>