Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions contrib/testgen/key_tests.test_vectors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## Test Vectors
Private key and address test vectors for test `key_tests` were crafted by hand.
The following document illustrates how they have been chosen.

### compressed private key
```
80111111111111111111111111111111111111111111111111111111111111111101
969b59a7 d30dd0eb7b64944926f4006e84a74a4bdd1f49c30f651082425c0747
80111111111111111111111111111111111111111111111111111111111111111101969b59a7
KwntMbt59tTsj8xqpqYqRRWufyjGunvhSyeMo3NTYpFYzZbXJ5Hp
DU9umLs2Ze8eNRo69wbSj5HeufphJawFPh
```

### uncompressed private key
```
801111111111111111111111111111111111111111111111111111111111111111
e5ce7258 ab95e95003a854ccfca9f027108d9b9b35bc113a9095aeef3e1bc836
801111111111111111111111111111111111111111111111111111111111111111e5ce7258
5HwoXVkHoRM8sL2KmNRS217n1g8mPPBomrY7yehCuXC1115WWsh
DS1P3gwq6MFtatWprr2e2J32xGPd89n75C
```

// 2
### compressed private key
```
80222222222222222222222222222222222222222222222222222222222222222201
c2d1512d d4570cc56481d9bf6dbe147ed964a486b7b229f426b1320f77070c52
80222222222222222222222222222222222222222222222222222222222222222201c2d1512d
KxN4XYdzu6f9j3EMryaMwZvUVLk3y29M4QZ2xwPoFP2zwka1aWxU
DCiLe5VAcdLpGXURTDsaoryMWdMVBP9NoN
```

### uncompressed private key
```
802222222222222222222222222222222222222222222222222222222222222222
d15081bf 4cb85f0f73cd32c4b21dace0e3ed3ffce7020023fe448d97b20b278d
802222222222222222222222222222222222222222222222222222222222222222d15081bf
5J5KUK3VXP8HUefNVYPxwxVRokScZdWXpu1Tj8LfaAXMqHzMmbk
DMQ3t1L7BmTwL5wpZ9mek1KUaCRLJSXJWV
```





30 changes: 14 additions & 16 deletions src/test/key_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,17 @@
#include <vector>

#include <boost/test/unit_test.hpp>

static const std::string strSecret1 = "5HxWvvfubhXpYYpS3tJkw6fq9jE9j18THftkZjHHfmFiWtmAbrj";
static const std::string strSecret2 = "5KC4ejrDjv152FGwP386VD1i2NYc5KkfSMyv1nGy1VGDxGHqVY3";
static const std::string strSecret1C = "Kwr371tjA9u2rFSMZjTNun2PXXP3WPZu2afRHTcta6KxEUdm1vEw";
static const std::string strSecret2C = "L3Hq7a8FEQwJkW1M2GNKDW28546Vp5miewcCzSqUD9kCAXrJdS3g";
static const std::string addr1 = "1QFqqMUD55ZV3PJEJZtaKCsQmjLT6JkjvJ";
static const std::string addr2 = "1F5y5E5FMc5YzdJtB9hLaUe43GDxEKXENJ";
static const std::string addr1C = "1NoJrossxPBKfCHuJXT4HadJrXRE9Fxiqs";
static const std::string addr2C = "1CRj2HyM1CXWzHAXLQtiGLyggNT9WQqsDs";
static const std::string strSecret1 = "5HwoXVkHoRM8sL2KmNRS217n1g8mPPBomrY7yehCuXC1115WWsh";
static const std::string strSecret2 = "5J5KUK3VXP8HUefNVYPxwxVRokScZdWXpu1Tj8LfaAXMqHzMmbk";
static const std::string strSecret1C = "KwntMbt59tTsj8xqpqYqRRWufyjGunvhSyeMo3NTYpFYzZbXJ5Hp";
static const std::string strSecret2C = "KxN4XYdzu6f9j3EMryaMwZvUVLk3y29M4QZ2xwPoFP2zwka1aWxU";
static const std::string addr1 = "DS1P3gwq6MFtatWprr2e2J32xGPd89n75C";
static const std::string addr2 = "DMQ3t1L7BmTwL5wpZ9mek1KUaCRLJSXJWV";
static const std::string addr1C = "DU9umLs2Ze8eNRo69wbSj5HeufphJawFPh";
static const std::string addr2C = "DCiLe5VAcdLpGXURTDsaoryMWdMVBP9NoN";

static const std::string strAddressBad = "1HV9Lc3sNHZxwj4Zk6fB38tEmBryq2cBiF";


BOOST_FIXTURE_TEST_SUITE(key_tests, BasicTestingSetup)

BOOST_AUTO_TEST_CASE(key_test1)
Expand Down Expand Up @@ -138,19 +136,19 @@ BOOST_AUTO_TEST_CASE(key_test1)
BOOST_CHECK(key1.Sign(hashMsg, detsig));
BOOST_CHECK(key1C.Sign(hashMsg, detsigc));
BOOST_CHECK(detsig == detsigc);
BOOST_CHECK(detsig == ParseHex("304402205dbbddda71772d95ce91cd2d14b592cfbc1dd0aabd6a394b6c2d377bbe59d31d022014ddda21494a4e221f0824f0b8b924c43fa43c0ad57dccdaa11f81a6bd4582f6"));
BOOST_CHECK(detsig == ParseHex("3044022064b7d73eee352ebd0a9eea03b56141bb80ac71885506ca38cae731000a704b50022047ff0729ca4e6ffd41b7b4928cfa05ab1148dc4ecb7030bec53f7009a86d6ad2"));
BOOST_CHECK(key2.Sign(hashMsg, detsig));
BOOST_CHECK(key2C.Sign(hashMsg, detsigc));
BOOST_CHECK(detsig == detsigc);
BOOST_CHECK(detsig == ParseHex("3044022052d8a32079c11e79db95af63bb9600c5b04f21a9ca33dc129c2bfa8ac9dc1cd5022061d8ae5e0f6c1a16bde3719c64c2fd70e404b6428ab9a69566962e8771b5944d"));
BOOST_CHECK(detsig == ParseHex("30440220056e087458d463ac8197b2036c4cf2fd88f6f19318d313c47d299682b5e9b55e022063e9cb599949c38a1762c18c5440e382779d63df12702ab93efebd510f28f3fc"));
BOOST_CHECK(key1.SignCompact(hashMsg, detsig));
BOOST_CHECK(key1C.SignCompact(hashMsg, detsigc));
BOOST_CHECK(detsig == ParseHex("1c5dbbddda71772d95ce91cd2d14b592cfbc1dd0aabd6a394b6c2d377bbe59d31d14ddda21494a4e221f0824f0b8b924c43fa43c0ad57dccdaa11f81a6bd4582f6"));
BOOST_CHECK(detsigc == ParseHex("205dbbddda71772d95ce91cd2d14b592cfbc1dd0aabd6a394b6c2d377bbe59d31d14ddda21494a4e221f0824f0b8b924c43fa43c0ad57dccdaa11f81a6bd4582f6"));
BOOST_CHECK(detsig == ParseHex("1c64b7d73eee352ebd0a9eea03b56141bb80ac71885506ca38cae731000a704b5047ff0729ca4e6ffd41b7b4928cfa05ab1148dc4ecb7030bec53f7009a86d6ad2"));
BOOST_CHECK(detsigc == ParseHex("2064b7d73eee352ebd0a9eea03b56141bb80ac71885506ca38cae731000a704b5047ff0729ca4e6ffd41b7b4928cfa05ab1148dc4ecb7030bec53f7009a86d6ad2"));
BOOST_CHECK(key2.SignCompact(hashMsg, detsig));
BOOST_CHECK(key2C.SignCompact(hashMsg, detsigc));
BOOST_CHECK(detsig == ParseHex("1c52d8a32079c11e79db95af63bb9600c5b04f21a9ca33dc129c2bfa8ac9dc1cd561d8ae5e0f6c1a16bde3719c64c2fd70e404b6428ab9a69566962e8771b5944d"));
BOOST_CHECK(detsigc == ParseHex("2052d8a32079c11e79db95af63bb9600c5b04f21a9ca33dc129c2bfa8ac9dc1cd561d8ae5e0f6c1a16bde3719c64c2fd70e404b6428ab9a69566962e8771b5944d"));
BOOST_CHECK(detsig == ParseHex("1b056e087458d463ac8197b2036c4cf2fd88f6f19318d313c47d299682b5e9b55e63e9cb599949c38a1762c18c5440e382779d63df12702ab93efebd510f28f3fc"));
BOOST_CHECK(detsigc == ParseHex("1f056e087458d463ac8197b2036c4cf2fd88f6f19318d313c47d299682b5e9b55e63e9cb599949c38a1762c18c5440e382779d63df12702ab93efebd510f28f3fc"));
}

BOOST_AUTO_TEST_CASE(key_signature_tests)
Expand Down
1 change: 1 addition & 0 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

#include <boost/algorithm/string/replace.hpp>
#include <boost/thread.hpp>
#include <boost/bind.hpp>

#if defined(NDEBUG)
# error "DigiByte cannot be compiled without assertions."
Expand Down
1 change: 1 addition & 0 deletions src/validationinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <atomic>
#include <future>

#include <boost/bind.hpp>
#include <boost/signals2/signal.hpp>

struct MainSignalsInstance {
Expand Down