Skip to content

Commit

Permalink
Implement GetMetadata in DescriptorScriptPubKeyMan
Browse files Browse the repository at this point in the history
Summary:
Backport of Core [[bitcoin/bitcoin#16528 | PR16528]] [31/43] : bitcoin/bitcoin@b713baa

Depends on D8453

Test Plan:
  ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8454
  • Loading branch information
achow101 authored and deadalnix committed Nov 19, 2020
1 parent f18cf5b commit 0fcd2b0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/wallet/scriptpubkeyman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2125,6 +2125,21 @@ DescriptorScriptPubKeyMan::FillPSBT(PartiallySignedTransaction &psbtx,

std::unique_ptr<CKeyMetadata>
DescriptorScriptPubKeyMan::GetMetadata(const CTxDestination &dest) const {
std::unique_ptr<SigningProvider> provider =
GetSigningProvider(GetScriptForDestination(dest));
if (provider) {
KeyOriginInfo orig;
CKeyID key_id = GetKeyForDestination(*provider, dest);
if (provider->GetKeyOrigin(key_id, orig)) {
LOCK(cs_desc_man);
std::unique_ptr<CKeyMetadata> meta =
std::make_unique<CKeyMetadata>();
meta->key_origin = orig;
meta->has_key_origin = true;
meta->nCreateTime = m_wallet_descriptor.creation_time;
return meta;
}
}
return nullptr;
}

Expand Down

0 comments on commit 0fcd2b0

Please sign in to comment.