mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-27 01:11:59 +02:00
descriptor: never ignore the return value when deriving an extended key
In some cases we asserted it succeeded, in others we were just ignoring it
This commit is contained in:
parent
d3599c22bd
commit
0ca258a5ac
@ -328,7 +328,7 @@ class BIP32PubkeyProvider final : public PubkeyProvider
|
|||||||
{
|
{
|
||||||
if (!GetExtKey(arg, xprv)) return false;
|
if (!GetExtKey(arg, xprv)) return false;
|
||||||
for (auto entry : m_path) {
|
for (auto entry : m_path) {
|
||||||
xprv.Derive(xprv, entry);
|
if (!xprv.Derive(xprv, entry)) return false;
|
||||||
if (entry >> 31) {
|
if (entry >> 31) {
|
||||||
last_hardened = xprv;
|
last_hardened = xprv;
|
||||||
}
|
}
|
||||||
@ -498,8 +498,8 @@ public:
|
|||||||
CExtKey extkey;
|
CExtKey extkey;
|
||||||
CExtKey dummy;
|
CExtKey dummy;
|
||||||
if (!GetDerivedExtKey(arg, extkey, dummy)) return false;
|
if (!GetDerivedExtKey(arg, extkey, dummy)) return false;
|
||||||
if (m_derive == DeriveType::UNHARDENED) extkey.Derive(extkey, pos);
|
if (m_derive == DeriveType::UNHARDENED && !extkey.Derive(extkey, pos)) return false;
|
||||||
if (m_derive == DeriveType::HARDENED) extkey.Derive(extkey, pos | 0x80000000UL);
|
if (m_derive == DeriveType::HARDENED && !extkey.Derive(extkey, pos | 0x80000000UL)) return false;
|
||||||
key = extkey.key;
|
key = extkey.key;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ void DoCheck(const std::string& prv, const std::string& pub, const std::string&
|
|||||||
for (const auto& xpub_pair : parent_xpub_cache) {
|
for (const auto& xpub_pair : parent_xpub_cache) {
|
||||||
const CExtPubKey& xpub = xpub_pair.second;
|
const CExtPubKey& xpub = xpub_pair.second;
|
||||||
CExtPubKey der;
|
CExtPubKey der;
|
||||||
xpub.Derive(der, i);
|
BOOST_CHECK(xpub.Derive(der, i));
|
||||||
pubkeys.insert(der.pubkey);
|
pubkeys.insert(der.pubkey);
|
||||||
}
|
}
|
||||||
int count_pks = 0;
|
int count_pks = 0;
|
||||||
@ -265,7 +265,7 @@ void DoCheck(const std::string& prv, const std::string& pub, const std::string&
|
|||||||
const CExtPubKey& xpub = xpub_pair.second;
|
const CExtPubKey& xpub = xpub_pair.second;
|
||||||
pubkeys.insert(xpub.pubkey);
|
pubkeys.insert(xpub.pubkey);
|
||||||
CExtPubKey der;
|
CExtPubKey der;
|
||||||
xpub.Derive(der, i);
|
BOOST_CHECK(xpub.Derive(der, i));
|
||||||
pubkeys.insert(der.pubkey);
|
pubkeys.insert(der.pubkey);
|
||||||
}
|
}
|
||||||
int count_pks = 0;
|
int count_pks = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user