Skip to content

Commit 807098d

Browse files
committed
updated unit tests fixes dashpay#12
1 parent f7406f9 commit 807098d

File tree

7 files changed

+45
-60
lines changed

7 files changed

+45
-60
lines changed

src/init.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ int main(int argc, char* argv[])
269269
bool fRet = false;
270270

271271
// Connect bitcoind signal handlers
272-
noui_connect();
272+
//noui_connect();
273273

274274
fRet = AppInit(argc, argv);
275275

src/test/Checkpoints_tests.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ BOOST_AUTO_TEST_SUITE(Checkpoints_tests)
1414

1515
BOOST_AUTO_TEST_CASE(sanity)
1616
{
17-
uint256 p1500 = uint256("0x841a2965955dd288cfa707a755d05a54e45f8bd476835ec9af4402a2b59a2967");
18-
uint256 p120000 = uint256("0xbd9d26924f05f6daa7f0155f32828ec89e8e29cee9e7121b026a7a3552ac6131");
19-
BOOST_CHECK(Checkpoints::CheckBlock(1500, p1500));
20-
BOOST_CHECK(Checkpoints::CheckBlock(120000, p120000));
17+
uint256 p24200 = uint256("0xd7ed819858011474c8b0cae4ad0b9bdbb745becc4c386bc22d1220cc5a4d1787");
18+
uint256 p84065 = uint256("0xa904170a5a98109b2909379d9bc03ef97a6b44d5dafbc9084b8699b0cba5aa98");
19+
BOOST_CHECK(Checkpoints::CheckBlock(24200, p24200));
20+
BOOST_CHECK(Checkpoints::CheckBlock(84065, p84065));
21+
2122

22-
2323
// Wrong hashes at checkpoints should fail:
24-
BOOST_CHECK(!Checkpoints::CheckBlock(1500, p120000));
25-
BOOST_CHECK(!Checkpoints::CheckBlock(120000, p1500));
24+
BOOST_CHECK(!Checkpoints::CheckBlock(24200, p84065));
25+
BOOST_CHECK(!Checkpoints::CheckBlock(84065, p24200));
2626

2727
// ... but any hash not at a checkpoint should succeed:
28-
BOOST_CHECK(Checkpoints::CheckBlock(1500+1, p120000));
29-
BOOST_CHECK(Checkpoints::CheckBlock(120000+1, p1500));
28+
BOOST_CHECK(Checkpoints::CheckBlock(24200+1, p84065));
29+
BOOST_CHECK(Checkpoints::CheckBlock(84065+1, p24200));
3030

31-
BOOST_CHECK(Checkpoints::GetTotalBlocksEstimate() >= 120000);
32-
}
31+
BOOST_CHECK(Checkpoints::GetTotalBlocksEstimate() >= 84065);
32+
}
3333

3434
BOOST_AUTO_TEST_SUITE_END()

src/test/bloom_tests.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ BOOST_AUTO_TEST_CASE(bloom_create_insert_serialize_with_tweak)
6666

6767
BOOST_CHECK_EQUAL_COLLECTIONS(stream.begin(), stream.end(), expected.begin(), expected.end());
6868
}
69-
69+
#include <iomanip>
7070
BOOST_AUTO_TEST_CASE(bloom_create_insert_key)
7171
{
72-
string strSecret = string("6v7hgtX6r7frdh7XDRJ3L4JRLMAn9chCgNgSccwqWdp69XfPdX6");
72+
string strSecret = string("7hd8aZQPdCiE2rAP1jnTQS8pGfZjTdepoRiRphjUH55TrSAURvs");
7373
CBitcoinSecret vchSecret;
7474
BOOST_CHECK(vchSecret.SetString(strSecret));
7575

@@ -85,7 +85,7 @@ BOOST_AUTO_TEST_CASE(bloom_create_insert_key)
8585
CDataStream stream(SER_NETWORK, PROTOCOL_VERSION);
8686
filter.Serialize(stream, SER_NETWORK, PROTOCOL_VERSION);
8787

88-
vector<unsigned char> vch = ParseHex("0322ed23080000000000000001");
88+
vector<unsigned char> vch = ParseHex("03814f4f080000000000000001");
8989
vector<char> expected(vch.size());
9090

9191
for (unsigned int i = 0; i < vch.size(); i++)

src/test/data/alertTests

-1 Bytes
Binary file not shown.

src/test/key_tests.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010

1111
using namespace std;
1212

13-
static const string strSecret1 ("6uu5bsZLA2Lm6yCxgwxDxHyZmhYeqBMLQT83Fyq738YhYucQPQf");
14-
static const string strSecret2 ("6vZDRwYgTNidWzmKs9x8QzQGeWCqbdUtNRpEKZMaP67ZSn8XMjb");
15-
static const string strSecret1C ("T6UsJv9hYpvDfM5noKYkB3vfeHxhyegkeWJ4y7qKeQJuyXMK11XX");
16-
static const string strSecret2C ("T9PBs5kq9QrkBPxeGNWKitMi4XuFVr25jaXTnuopLVZxCUAJbixA");
17-
static const CBitcoinAddress addr1 ("LWaFezDtucfCA4xcVEfs3R3xfgGWjSwcZr");
18-
static const CBitcoinAddress addr2 ("LXwHM6mRd432EzLJYwuKQMPhTzrgr7ur9K");
19-
static const CBitcoinAddress addr1C("LZWK8h7C166niP6GmpUmiGrvn4oxPqQgFV");
20-
static const CBitcoinAddress addr2C("Lgb6tdqmdW3n5E12johSuEAqRMt4kAr7yu");
13+
static const string strSecret1 ("7hXGq2hzJAv3oSiEp26uYNE7Yr26FYUrEucR7zbuxU9xuVbHfo2");
14+
static const string strSecret2 ("7g3aWyEmFjLr4Pfj3n135jCKMBFX8mvLg7152Juc7rXrXa8MGc1");
15+
static const string strSecret1C ("WZrcrzXutnm9MzV1xXs4uSgsuZMpBBwvLPDKTsF6jprZkfD4PRBn");
16+
static const string strSecret2C ("WTLNwHDkL1tbXy3vbFdABsEwz4F61KGRqbVJkn3C1FdBbbr58PXq");
17+
static const CBitcoinAddress addr1 ("VkStwWGzHTkAze3CTMcsrPBz8M8CuvrieC");
18+
static const CBitcoinAddress addr2 ("VearpxbiSKyBDuureJ5ukYy7you2KtMXyA");
19+
static const CBitcoinAddress addr1C("VsafVYo2FXVnfz8ygsowqH2swEjeZUaPNw");
20+
static const CBitcoinAddress addr2C("VhUkQkCT3G3gnmJ2AoAdrc9MGFr2qPDCyH");
2121

2222

23-
static const string strAddressBad("LRjyUS2uuieEPkhZNdQz8hE5YycxVEqSXA");
23+
static const string strAddressBad("VtDPWGdhCnvVsv2vCHT2JvmQZSfw5jNGe1");
2424

2525

2626
#ifdef KEY_TESTS_DUMPINFO

src/test/miner_tests.cpp

+15-30
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,19 @@ struct {
1515
unsigned char extranonce;
1616
unsigned int nonce;
1717
} blockinfo[] = {
18-
{4, 0xa4ad9f65}, {2, 0x15cf2b27}, {1, 0x037620ac}, {1, 0x700d9c54},
19-
{2, 0xce79f74f}, {2, 0x52d9c194}, {1, 0x77bc3efc}, {2, 0xbb62c5e8},
20-
{2, 0x83ff997a}, {1, 0x48b984ee}, {1, 0xef925da0}, {2, 0x680d2979},
21-
{2, 0x08953af7}, {1, 0x087dd553}, {2, 0x210e2818}, {2, 0xdfffcdef},
22-
{1, 0xeea1b209}, {2, 0xba4a8943}, {1, 0xa7333e77}, {1, 0x344f3e2a},
23-
{3, 0xd651f08e}, {2, 0xeca3957f}, {2, 0xca35aa49}, {1, 0x6bb2065d},
24-
{2, 0x0170ee44}, {1, 0x6e12f4aa}, {2, 0x43f4f4db}, {2, 0x279c1c44},
25-
{2, 0xb5a50f10}, {2, 0xb3902841}, {2, 0xd198647e}, {2, 0x6bc40d88},
26-
{1, 0x633a9a1c}, {2, 0x9a722ed8}, {2, 0x55580d10}, {1, 0xd65022a1},
27-
{2, 0xa12ffcc8}, {1, 0x75a6a9c7}, {2, 0xfb7c80b7}, {1, 0xe8403e6c},
28-
{1, 0xe34017a0}, {3, 0x659e177b}, {2, 0xba5c40bf}, {5, 0x022f11ef},
29-
{1, 0xa9ab516a}, {5, 0xd0999ed4}, {1, 0x37277cb3}, {1, 0x830f735f},
30-
{1, 0xc6e3d947}, {2, 0x824a0c1b}, {1, 0x99962416}, {1, 0x75336f63},
31-
{1, 0xaacf0fea}, {1, 0xd6531aec}, {5, 0x7afcf541}, {5, 0x9d6fac0d},
32-
{1, 0x4cf5c4df}, {1, 0xabe0f2a0}, {6, 0x4a3dac18}, {2, 0xf265febe},
33-
{2, 0x1bc9f23f}, {1, 0xad49ab71}, {1, 0x9f2d8923}, {1, 0x15acb65d},
34-
{2, 0xd1cecb52}, {2, 0xf856808b}, {1, 0x0fa96e29}, {1, 0xe063ecbc},
35-
{1, 0x78d926c6}, {5, 0x3e38ad35}, {5, 0x73901915}, {1, 0x63424be0},
36-
{1, 0x6d6b0a1d}, {2, 0x888ba681}, {2, 0xe96b0714}, {1, 0xb7fcaa55},
37-
{2, 0x19c106eb}, {1, 0x5aa13484}, {2, 0x5bf4c2f3}, {2, 0x94d401dd},
38-
{1, 0xa9bc23d9}, {1, 0x3a69c375}, {1, 0x56ed2006}, {5, 0x85ba6dbd},
39-
{1, 0xfd9b2000}, {1, 0x2b2be19a}, {1, 0xba724468}, {1, 0x717eb6e5},
40-
{1, 0x70de86d9}, {1, 0x74e23a42}, {1, 0x49e92832}, {2, 0x6926dbb9},
41-
{0, 0x64452497}, {1, 0x54306d6f}, {2, 0x97ebf052}, {2, 0x55198b70},
42-
{2, 0x03fe61f0}, {1, 0x98f9e67f}, {1, 0xc0842a09}, {1, 0xdfed39c5},
43-
{1, 0x3144223e}, {1, 0xb3d12f84}, {1, 0x7366ceb7}, {5, 0x6240691b},
44-
{2, 0xd3529b57}, {1, 0xf4cae3b1}, {1, 0x5b1df222}, {1, 0xa16a5c70},
45-
{2, 0xbbccedc6}, {2, 0xfe38d0ef},
18+
{0, 485620}, {0, 1313570}, {0, 1427977}, {0, 881757},
19+
{0, 166059}, {0, 1467245}, {0, 650707}, {0, 3012782},
20+
{0, 22256}, {0, 315868}, {0, 191591}, {0, 90455},
21+
{0, 259742}, {0, 285170}, {0, 306353}, {0, 1779746},
22+
{0, 1456538}, {0, 365826}, {0, 551720}, {0, 2154},
23+
{0, 3480677}, {0, 1106247}, {0, 4498476}, {0, 31876},
24+
{0, 1464164}, {0, 1341575}, {0, 81652}, {0, 1306582},
25+
{0, 4725550}, {0, 1314926}, {0, 2188928}, {0, 2428258},
26+
{0, 222786}, {0, 271449}, {0, 767753}, {0, 235492},
27+
{0, 1068131}, {0, 21501}, {0, 1513107}, {0, 1534775},
28+
{0, 960921}, {0, 5340054}, {0, 597843}, {0, 1867048},
29+
{0, 958421}, {0, 735681}, {0, 720239}, {0, 1489636},
30+
{0, 476580}, {0, 687332},
4631
};
4732

4833
// NOTE: These tests rely on CreateNewBlock doing its own self-validation!
@@ -58,12 +43,12 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
5843
BOOST_CHECK(pblocktemplate = CreateNewBlockWithKey(reservekey));
5944

6045
// We can't make transactions until we have inputs
61-
// Therefore, load 100 blocks :)
46+
// Therefore, load 50 blocks :)
6247
std::vector<CTransaction*>txFirst;
6348
for (unsigned int i = 0; i < sizeof(blockinfo)/sizeof(*blockinfo); ++i)
6449
{
6550
CBlock *pblock = &pblocktemplate->block; // pointer for convenience
66-
pblock->nVersion = 1;
51+
pblock->nVersion = 2;
6752
pblock->nTime = pindexBest->GetMedianTimePast()+1;
6853
pblock->vtx[0].vin[0].scriptSig = CScript();
6954
pblock->vtx[0].vin[0].scriptSig.push_back(blockinfo[i].extranonce);

src/test/rpc_tests.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,14 @@ BOOST_AUTO_TEST_CASE(rpc_rawsign)
154154
Value r;
155155
// input is a 1-of-2 multisig (so is output):
156156
string prevout =
157-
"[{\"txid\":\"b4cc287e58f87cdae59417329f710f3ecd75a4ee1d2872b7248f50977c8493f3\","
158-
"\"vout\":1,\"scriptPubKey\":\"a914b10c9df5f7edf436c697f02f1efdba4cf399615187\","
159-
"\"redeemScript\":\"512103debedc17b3df2badbcdd86d5feb4562b86fe182e5998abd8bcd4f122c6155b1b21027e940bb73ab8732bfdf7f9216ecefca5b94d6df834e77e108f68e66f126044c052ae\"}]";
157+
"[{\"txid\":\"d6f72aab8ff86ff6289842a0424319bf2ddba85dc7c52757912297f948286389\","
158+
"\"vout\":1,\"scriptPubKey\":\"a914618b10a3b621b48718c0028ad336b5e9b4d14da687\","
159+
"\"redeemScript\":\"524104d86205f275d002f5eb7c2444d11cf99faf94b4af72b08e8b46f420beab16c174cc1381395aa3daf569a5afde6d37c3a32b9c98ffed18bf134ad598eaec1101a141046c5956eabbfff64e411cceeb7d357132a066eb5815f5fbc3569f3b8c4c4337a01ef2652b624ed492df5b1c32c8c7edbeb6c119e2db4d194027e62d5c2a5b174f52ae\"}]";
160160
r = CallRPC(string("createrawtransaction ")+prevout+" "+
161-
"{\"3HqAe9LtNBjnsfM4CyYaWTnvCaUYT7v4oZ\":11}");
161+
"{\"3Aan4ZFCXF6uZKwFdru2Bh6eaqVrTLPsEw\":11}");
162162
string notsigned = r.get_str();
163-
string privkey1 = "\"T6hoRM7L8u4f9vHd4eGMAmwV6AMCE11PvYi7YjrdegG223kw64r1\"";
164-
string privkey2 = "\"T5Xu6pe5iqQYqXGxhcY2QEFr7NNoVQ5R6A4abpswunCTF9w85g8V\"";
163+
string privkey1 = "\"7hRmTUGbfa3GBBAiwY5Pjr53tMFVrnvHenyrVgWaJkWij77NX8m\"";
164+
string privkey2 = "\"7gVwRovRDjVxAob26LQxDWkR67QbzjaoUA8tD26mv2SGR6gAv7B\"";
165165
r = CallRPC(string("signrawtransaction ")+notsigned+" "+prevout+" "+"[]");
166166
BOOST_CHECK(find_value(r.get_obj(), "complete").get_bool() == false);
167167
r = CallRPC(string("signrawtransaction ")+notsigned+" "+prevout+" "+"["+privkey1+","+privkey2+"]");

0 commit comments

Comments
 (0)