diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-05-31 13:46:40 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-05-31 13:46:42 +0200 |
commit | 8c6df2b4ca1da716e2c834f0c3d18345c73c8c2c (patch) | |
tree | 3e4b700461a7cc967fd104f247402a1ea1c826df | |
parent | c5ee0cc11a330a98d03cae44f37856badd947d81 (diff) | |
parent | 91ef8344d4de28b0a659401ef5fefee6c3d9f7ae (diff) |
Merge bitcoin/bitcoin#22095: test: Additional BIP32 test vector for hardened derivation with leading zeros
91ef8344d4de28b0a659401ef5fefee6c3d9f7ae Additional test vector for hardened derivation with leading zeros (Kristaps Kaupe)
Pull request description:
See [Inconsistent BIP32 Derivations](https://blog.polychainlabs.com/bitcoin,/bip32,/bip39,/kdf/2021/05/17/inconsistent-bip32-derivations.html) and https://github.com/bitcoin/bips/pull/1030.
ACKs for top commit:
practicalswift:
cr ACK 91ef8344d4de28b0a659401ef5fefee6c3d9f7ae
sipa:
ACK 91ef8344d4de28b0a659401ef5fefee6c3d9f7ae. Verified that it matches the linked BIP32 update, and that it indeed tests derivation from a private key with leading 0 byte.
Tree-SHA512: 0a3ae7aed15e4e08e9bec5db8de53c6c03ed3b3632f390394eea422597755173cbd2228ff0cfa57f5aae3df9d4cdf03a8ef4725cc8bce86ab7d9c82ab9d479ad
-rw-r--r-- | src/test/bip32_tests.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/test/bip32_tests.cpp b/src/test/bip32_tests.cpp index 32329eb510..fb16c92647 100644 --- a/src/test/bip32_tests.cpp +++ b/src/test/bip32_tests.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2013-2020 The Bitcoin Core developers +// Copyright (c) 2013-2021 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -87,6 +87,18 @@ TestVector test3 = "xprv9uPDJpEQgRQfDcW7BkF7eTya6RPxXeJCqCJGHuCJ4GiRVLzkTXBAJMu2qaMWPrS7AANYqdq6vcBcBUdJCVVFceUvJFjaPdGZ2y9WACViL4L", 0); +TestVector test4 = + TestVector("3ddd5602285899a946114506157c7997e5444528f3003f6134712147db19b678") + ("xpub661MyMwAqRbcGczjuMoRm6dXaLDEhW1u34gKenbeYqAix21mdUKJyuyu5F1rzYGVxyL6tmgBUAEPrEz92mBXjByMRiJdba9wpnN37RLLAXa", + "xprv9s21ZrQH143K48vGoLGRPxgo2JNkJ3J3fqkirQC2zVdk5Dgd5w14S7fRDyHH4dWNHUgkvsvNDCkvAwcSHNAQwhwgNMgZhLtQC63zxwhQmRv", + 0x80000000) + ("xpub69AUMk3qDBi3uW1sXgjCmVjJ2G6WQoYSnNHyzkmdCHEhSZ4tBok37xfFEqHd2AddP56Tqp4o56AePAgCjYdvpW2PU2jbUPFKsav5ut6Ch1m", + "xprv9vB7xEWwNp9kh1wQRfCCQMnZUEG21LpbR9NPCNN1dwhiZkjjeGRnaALmPXCX7SgjFTiCTT6bXes17boXtjq3xLpcDjzEuGLQBM5ohqkao9G", + 0x80000001) + ("xpub6BJA1jSqiukeaesWfxe6sNK9CCGaujFFSJLomWHprUL9DePQ4JDkM5d88n49sMGJxrhpjazuXYWdMf17C9T5XnxkopaeS7jGk1GyyVziaMt", + "xprv9xJocDuwtYCMNAo3Zw76WENQeAS6WGXQ55RCy7tDJ8oALr4FWkuVoHJeHVAcAqiZLE7Je3vZJHxspZdFHfnBEjHqU5hG1Jaj32dVoS6XLT1", + 0); + static void RunTest(const TestVector &test) { std::vector<unsigned char> seed = ParseHex(test.strHexMaster); CExtKey key; @@ -135,4 +147,8 @@ BOOST_AUTO_TEST_CASE(bip32_test3) { RunTest(test3); } +BOOST_AUTO_TEST_CASE(bip32_test4) { + RunTest(test4); +} + BOOST_AUTO_TEST_SUITE_END() |