Skip to content

Commit 8c6df2b

Browse files
author
MarcoFalke
committed
Merge bitcoin#22095: test: Additional BIP32 test vector for hardened derivation with leading zeros
91ef834 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 bitcoin/bips#1030. ACKs for top commit: practicalswift: cr ACK 91ef834 sipa: ACK 91ef834. 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
2 parents c5ee0cc + 91ef834 commit 8c6df2b

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/test/bip32_tests.cpp

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2013-2020 The Bitcoin Core developers
1+
// Copyright (c) 2013-2021 The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

@@ -87,6 +87,18 @@ TestVector test3 =
8787
"xprv9uPDJpEQgRQfDcW7BkF7eTya6RPxXeJCqCJGHuCJ4GiRVLzkTXBAJMu2qaMWPrS7AANYqdq6vcBcBUdJCVVFceUvJFjaPdGZ2y9WACViL4L",
8888
0);
8989

90+
TestVector test4 =
91+
TestVector("3ddd5602285899a946114506157c7997e5444528f3003f6134712147db19b678")
92+
("xpub661MyMwAqRbcGczjuMoRm6dXaLDEhW1u34gKenbeYqAix21mdUKJyuyu5F1rzYGVxyL6tmgBUAEPrEz92mBXjByMRiJdba9wpnN37RLLAXa",
93+
"xprv9s21ZrQH143K48vGoLGRPxgo2JNkJ3J3fqkirQC2zVdk5Dgd5w14S7fRDyHH4dWNHUgkvsvNDCkvAwcSHNAQwhwgNMgZhLtQC63zxwhQmRv",
94+
0x80000000)
95+
("xpub69AUMk3qDBi3uW1sXgjCmVjJ2G6WQoYSnNHyzkmdCHEhSZ4tBok37xfFEqHd2AddP56Tqp4o56AePAgCjYdvpW2PU2jbUPFKsav5ut6Ch1m",
96+
"xprv9vB7xEWwNp9kh1wQRfCCQMnZUEG21LpbR9NPCNN1dwhiZkjjeGRnaALmPXCX7SgjFTiCTT6bXes17boXtjq3xLpcDjzEuGLQBM5ohqkao9G",
97+
0x80000001)
98+
("xpub6BJA1jSqiukeaesWfxe6sNK9CCGaujFFSJLomWHprUL9DePQ4JDkM5d88n49sMGJxrhpjazuXYWdMf17C9T5XnxkopaeS7jGk1GyyVziaMt",
99+
"xprv9xJocDuwtYCMNAo3Zw76WENQeAS6WGXQ55RCy7tDJ8oALr4FWkuVoHJeHVAcAqiZLE7Je3vZJHxspZdFHfnBEjHqU5hG1Jaj32dVoS6XLT1",
100+
0);
101+
90102
static void RunTest(const TestVector &test) {
91103
std::vector<unsigned char> seed = ParseHex(test.strHexMaster);
92104
CExtKey key;
@@ -135,4 +147,8 @@ BOOST_AUTO_TEST_CASE(bip32_test3) {
135147
RunTest(test3);
136148
}
137149

150+
BOOST_AUTO_TEST_CASE(bip32_test4) {
151+
RunTest(test4);
152+
}
153+
138154
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)