Skip to content

Commit 6268bde

Browse files
committed
descriptor: Remove unused parent_info from BIP32PUbKeyProvider::GetPubKey
1 parent 0ff072c commit 6268bde

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/script/descriptor.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -396,16 +396,12 @@ class BIP32PubkeyProvider final : public PubkeyProvider
396396
size_t GetSize() const override { return 33; }
397397
bool GetPubKey(int pos, const SigningProvider& arg, CPubKey& key_out, KeyOriginInfo& final_info_out, const DescriptorCache* read_cache = nullptr, DescriptorCache* write_cache = nullptr) const override
398398
{
399-
// Info of parent of the to be derived pubkey
400-
KeyOriginInfo parent_info;
399+
KeyOriginInfo info;
401400
CKeyID keyid = m_root_extkey.pubkey.GetID();
402-
std::copy(keyid.begin(), keyid.begin() + sizeof(parent_info.fingerprint), parent_info.fingerprint);
403-
parent_info.path = m_path;
404-
405-
// Info of the derived key itself which is copied out upon successful completion
406-
KeyOriginInfo final_info_out_tmp = parent_info;
407-
if (m_derive == DeriveType::UNHARDENED) final_info_out_tmp.path.push_back((uint32_t)pos);
408-
if (m_derive == DeriveType::HARDENED) final_info_out_tmp.path.push_back(((uint32_t)pos) | 0x80000000L);
401+
std::copy(keyid.begin(), keyid.begin() + sizeof(info.fingerprint), info.fingerprint);
402+
info.path = m_path;
403+
if (m_derive == DeriveType::UNHARDENED) info.path.push_back((uint32_t)pos);
404+
if (m_derive == DeriveType::HARDENED) info.path.push_back(((uint32_t)pos) | 0x80000000L);
409405

410406
// Derive keys or fetch them from cache
411407
CExtPubKey final_extkey = m_root_extkey;
@@ -441,7 +437,7 @@ class BIP32PubkeyProvider final : public PubkeyProvider
441437
}
442438
if (!der) return false;
443439

444-
final_info_out = final_info_out_tmp;
440+
final_info_out = info;
445441
key_out = final_extkey.pubkey;
446442

447443
if (write_cache) {

0 commit comments

Comments
 (0)