mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Replace CScriptID and CKeyID in CTxDestination with dedicated type
This commit is contained in:
parent
3e7cff1e45
commit
aa375e66c1
28 changed files with 201 additions and 179 deletions
|
|
@ -178,16 +178,17 @@ CKeyID GetKeyForDestination(const CKeyStore& store, const CTxDestination& dest)
|
|||
{
|
||||
// Only supports destinations which map to single public keys, i.e. P2PKH,
|
||||
// P2WPKH, and P2SH-P2WPKH.
|
||||
if (auto id = boost::get<CKeyID>(&dest)) {
|
||||
return *id;
|
||||
if (auto id = boost::get<PKHash>(&dest)) {
|
||||
return CKeyID(*id);
|
||||
}
|
||||
if (auto witness_id = boost::get<WitnessV0KeyHash>(&dest)) {
|
||||
return CKeyID(*witness_id);
|
||||
}
|
||||
if (auto script_id = boost::get<CScriptID>(&dest)) {
|
||||
if (auto script_hash = boost::get<ScriptHash>(&dest)) {
|
||||
CScript script;
|
||||
CScriptID script_id(*script_hash);
|
||||
CTxDestination inner_dest;
|
||||
if (store.GetCScript(*script_id, script) && ExtractDestination(script, inner_dest)) {
|
||||
if (store.GetCScript(script_id, script) && ExtractDestination(script, inner_dest)) {
|
||||
if (auto inner_witness_id = boost::get<WitnessV0KeyHash>(&inner_dest)) {
|
||||
return CKeyID(*inner_witness_id);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue