diff options
author | Jonas Schnelli <jonas.schnelli@include7.ch> | 2015-07-23 16:22:37 +0200 |
---|---|---|
committer | Jonas Schnelli <jonas.schnelli@include7.ch> | 2015-07-23 16:32:31 +0200 |
commit | 8d2af54eccda83bfe86bb14069ad54d0e4ba357c (patch) | |
tree | 726db6fdbb2be4797ad11ddc1c6d2ca903332988 /src/test | |
parent | 7cb1f9f7eb8162a792b4b87bba99fa21c682582e (diff) |
extend bip32 tests to cover Base58c/CExtKey decode
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/bip32_tests.cpp | 11 |
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)); |