MCPcopy Create free account
hub / github.com/ElementsProject/elements / ImplicitlyLearnRelatedKeyScripts

Method ImplicitlyLearnRelatedKeyScripts

src/script/signingprovider.cpp:85–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85void FillableSigningProvider::ImplicitlyLearnRelatedKeyScripts(const CPubKey& pubkey)
86{
87 AssertLockHeld(cs_KeyStore);
88 CKeyID key_id = pubkey.GetID();
89 // This adds the redeemscripts necessary to detect P2WPKH and P2SH-P2WPKH
90 // outputs. Technically P2WPKH outputs don't have a redeemscript to be
91 // spent. However, our current IsMine logic requires the corresponding
92 // P2SH-P2WPKH redeemscript to be present in the wallet in order to accept
93 // payment even to P2WPKH outputs.
94 // Also note that having superfluous scripts in the keystore never hurts.
95 // They're only used to guide recursion in signing and IsMine logic - if
96 // a script is present but we can't do anything with it, it has no effect.
97 // "Implicitly" refers to fact that scripts are derived automatically from
98 // existing keys, and are present in memory, even without being explicitly
99 // loaded (e.g. from a file).
100 if (pubkey.IsCompressed()) {
101 CScript script = GetScriptForDestination(WitnessV0KeyHash(key_id));
102 // This does not use AddCScript, as it may be overridden.
103 CScriptID id(script);
104 mapScripts[id] = std::move(script);
105 }
106}
107
108bool FillableSigningProvider::GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const
109{

Callers

nothing calls this directly

Calls 4

GetScriptForDestinationFunction · 0.85
WitnessV0KeyHashClass · 0.85
GetIDMethod · 0.45
IsCompressedMethod · 0.45

Tested by

no test coverage detected