aboutsummaryrefslogtreecommitdiff
path: root/src/script/descriptor.cpp
diff options
context:
space:
mode:
authorAntoine Poinsot <darosior@protonmail.com>2022-07-19 11:43:20 +0200
committerAntoine Poinsot <darosior@protonmail.com>2022-08-04 11:32:24 +0200
commit0ca258a5ace798c4e54308aa8a09b1ab3302cd7e (patch)
treeec4cdf79913da2053279228075318d72ee633216 /src/script/descriptor.cpp
parentd3599c22bd4c6b3cfaaadd675e95ebe3b3cb1749 (diff)
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
Diffstat (limited to 'src/script/descriptor.cpp')
-rw-r--r--src/script/descriptor.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/script/descriptor.cpp b/src/script/descriptor.cpp
index 34a4da74f8..346a86cad8 100644
--- a/src/script/descriptor.cpp
+++ b/src/script/descriptor.cpp
@@ -328,7 +328,7 @@ class BIP32PubkeyProvider final : public PubkeyProvider
{
if (!GetExtKey(arg, xprv)) return false;
for (auto entry : m_path) {
- xprv.Derive(xprv, entry);
+ if (!xprv.Derive(xprv, entry)) return false;
if (entry >> 31) {
last_hardened = xprv;
}
@@ -498,8 +498,8 @@ public:
CExtKey extkey;
CExtKey dummy;
if (!GetDerivedExtKey(arg, extkey, dummy)) return false;
- if (m_derive == DeriveType::UNHARDENED) extkey.Derive(extkey, pos);
- if (m_derive == DeriveType::HARDENED) extkey.Derive(extkey, pos | 0x80000000UL);
+ if (m_derive == DeriveType::UNHARDENED && !extkey.Derive(extkey, pos)) return false;
+ if (m_derive == DeriveType::HARDENED && !extkey.Derive(extkey, pos | 0x80000000UL)) return false;
key = extkey.key;
return true;
}