mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
Change GetMetadata to use unique_ptr<CKeyMetadata>
This commit is contained in:
parent
72a9540df9
commit
8b9603bd0b
@ -3820,7 +3820,7 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
|
||||
|
||||
ScriptPubKeyMan* spk_man = pwallet->GetScriptPubKeyMan(scriptPubKey);
|
||||
if (spk_man) {
|
||||
if (const CKeyMetadata* meta = spk_man->GetMetadata(dest)) {
|
||||
if (const std::unique_ptr<CKeyMetadata> meta = spk_man->GetMetadata(dest)) {
|
||||
ret.pushKV("timestamp", meta->nCreateTime);
|
||||
if (meta->has_key_origin) {
|
||||
ret.pushKV("hdkeypath", WriteHDKeypath(meta->key_origin.path));
|
||||
|
@ -568,7 +568,7 @@ TransactionError LegacyScriptPubKeyMan::FillPSBT(PartiallySignedTransaction& psb
|
||||
return TransactionError::OK;
|
||||
}
|
||||
|
||||
const CKeyMetadata* LegacyScriptPubKeyMan::GetMetadata(const CTxDestination& dest) const
|
||||
std::unique_ptr<CKeyMetadata> LegacyScriptPubKeyMan::GetMetadata(const CTxDestination& dest) const
|
||||
{
|
||||
LOCK(cs_KeyStore);
|
||||
|
||||
@ -576,14 +576,14 @@ const CKeyMetadata* LegacyScriptPubKeyMan::GetMetadata(const CTxDestination& des
|
||||
if (!key_id.IsNull()) {
|
||||
auto it = mapKeyMetadata.find(key_id);
|
||||
if (it != mapKeyMetadata.end()) {
|
||||
return &it->second;
|
||||
return MakeUnique<CKeyMetadata>(it->second);
|
||||
}
|
||||
}
|
||||
|
||||
CScript scriptPubKey = GetScriptForDestination(dest);
|
||||
auto it = m_script_metadata.find(CScriptID(scriptPubKey));
|
||||
if (it != m_script_metadata.end()) {
|
||||
return &it->second;
|
||||
return MakeUnique<CKeyMetadata>(it->second);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@ -2041,7 +2041,7 @@ TransactionError DescriptorScriptPubKeyMan::FillPSBT(PartiallySignedTransaction&
|
||||
return TransactionError::OK;
|
||||
}
|
||||
|
||||
const CKeyMetadata* DescriptorScriptPubKeyMan::GetMetadata(const CTxDestination& dest) const
|
||||
std::unique_ptr<CKeyMetadata> DescriptorScriptPubKeyMan::GetMetadata(const CTxDestination& dest) const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ public:
|
||||
|
||||
virtual int64_t GetTimeFirstKey() const { return 0; }
|
||||
|
||||
virtual const CKeyMetadata* GetMetadata(const CTxDestination& dest) const { return nullptr; }
|
||||
virtual std::unique_ptr<CKeyMetadata> GetMetadata(const CTxDestination& dest) const { return nullptr; }
|
||||
|
||||
virtual std::unique_ptr<SigningProvider> GetSolvingProvider(const CScript& script) const { return nullptr; }
|
||||
|
||||
@ -355,7 +355,7 @@ public:
|
||||
|
||||
int64_t GetTimeFirstKey() const override;
|
||||
|
||||
const CKeyMetadata* GetMetadata(const CTxDestination& dest) const override;
|
||||
std::unique_ptr<CKeyMetadata> GetMetadata(const CTxDestination& dest) const override;
|
||||
|
||||
bool CanGetAddresses(bool internal = false) const override;
|
||||
|
||||
@ -560,7 +560,7 @@ public:
|
||||
|
||||
int64_t GetTimeFirstKey() const override;
|
||||
|
||||
const CKeyMetadata* GetMetadata(const CTxDestination& dest) const override;
|
||||
std::unique_ptr<CKeyMetadata> GetMetadata(const CTxDestination& dest) const override;
|
||||
|
||||
bool CanGetAddresses(bool internal = false) const override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user