Skip to content

Commit

Permalink
partial (missing function GetKeyForDestination) Merge bitcoin#11403: …
Browse files Browse the repository at this point in the history
…SegWit wallet support
  • Loading branch information
knst committed Sep 16, 2023
1 parent c689f55 commit b65cea5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/script/signingprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,13 @@ bool FillableSigningProvider::GetCScript(const CScriptID &hash, CScript& redeemS
}
return false;
}

CKeyID GetKeyForDestination(const SigningProvider& store, const CTxDestination& dest)
{
// Only supports destinations which map to single public keys, i.e. P2PKH
const PKHash *pkhash = std::get_if<PKHash>(&dest);

if (pkhash != nullptr) return ToKeyID(*pkhash);

return CKeyID();
}
3 changes: 3 additions & 0 deletions src/script/signingprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,7 @@ class FillableSigningProvider : public SigningProvider
virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const override;
};

/** Return the CKeyID of the key involved in a script (if there is a unique one). */
CKeyID GetKeyForDestination(const SigningProvider& store, const CTxDestination& dest);

#endif // BITCOIN_SCRIPT_SIGNINGPROVIDER_H

0 comments on commit b65cea5

Please sign in to comment.