aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-07-27 13:16:19 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-07-27 13:20:54 +0200
commitd43297c5ba951df535df704e321a883f97475c35 (patch)
tree823facd0526aa0bb7cacd25bb415ece26c1e1f77 /src/test
parentf6850d58f7dd87de44dd25be0fc1067625fa8d3a (diff)
parent6f8b6d339bf6d6f7fe5a23180e668f7734755d91 (diff)
Merge pull request #6468
6f8b6d3 don't try to decode invalid encoded ext keys (Jonas Schnelli) 8d2af54 extend bip32 tests to cover Base58c/CExtKey decode (Jonas Schnelli) 7cb1f9f fix and extend CBitcoinExtKeyBase template (Jonas Schnelli)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/bip32_tests.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/bip32_tests.cpp b/src/test/bip32_tests.cpp
index 0d815c27fd..69084213a2 100644
--- a/src/test/bip32_tests.cpp
+++ b/src/test/bip32_tests.cpp
@@ -88,12 +88,23 @@ void RunTest(const TestVector &test) {
unsigned char data[74];
key.Encode(data);
pubkey.Encode(data);
+
// Test private key
CBitcoinExtKey b58key; b58key.SetKey(key);
BOOST_CHECK(b58key.ToString() == derive.prv);
+
+ CBitcoinExtKey b58keyDecodeCheck(derive.prv);
+ CExtKey checkKey = b58keyDecodeCheck.GetKey();
+ assert(checkKey == key); //ensure a base58 decoded key also matches
+
// Test public key
CBitcoinExtPubKey b58pubkey; b58pubkey.SetKey(pubkey);
BOOST_CHECK(b58pubkey.ToString() == derive.pub);
+
+ CBitcoinExtPubKey b58PubkeyDecodeCheck(derive.pub);
+ CExtPubKey checkPubKey = b58PubkeyDecodeCheck.GetKey();
+ assert(checkPubKey == pubkey); //ensure a base58 decoded pubkey also matches
+
// Derive new keys
CExtKey keyNew;
BOOST_CHECK(key.Derive(keyNew, derive.nChild));