Changeset View
Changeset View
Standalone View
Standalone View
src/script/signingprovider.h
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Fillable signing provider that keeps keys in an address->secret map | * Fillable signing provider that keeps keys in an address->secret map | ||||
*/ | */ | ||||
class FillableSigningProvider : public SigningProvider { | class FillableSigningProvider : public SigningProvider { | ||||
protected: | protected: | ||||
using KeyMap = std::map<CKeyID, CKey>; | using KeyMap = std::map<CKeyID, CKey>; | ||||
using ScriptMap = std::map<CScriptID, CScript>; | using ScriptMap = std::map<CScriptID, CScript>; | ||||
/** | |||||
* Map of key id to unencrypted private keys known by the signing provider. | |||||
* Map may be empty if the provider has another source of keys, like an | |||||
* encrypted store. | |||||
*/ | |||||
KeyMap mapKeys GUARDED_BY(cs_KeyStore); | KeyMap mapKeys GUARDED_BY(cs_KeyStore); | ||||
/** | |||||
* (This comment has been elided for clarity since most of it detailed Core | |||||
* SegWit implementation details, see Core commit 005f8a9) | |||||
* | |||||
* The FillableSigningProvider::mapScripts script map should not be confused | |||||
* with LegacyScriptPubKeyMan::setWatchOnly script set. The two collections | |||||
* can hold the same scripts, but they serve different purposes. The | |||||
* setWatchOnly script set is intended to expand the set of outputs the | |||||
* wallet considers payments. Every output with a script it contains is | |||||
* considered to belong to the wallet, regardless of whether the script is | |||||
* solvable or signable. By contrast, the scripts in mapScripts are only | |||||
* used for solving, and to restrict which outputs are considered payments | |||||
* by the wallet. An output with a script in mapScripts, unlike | |||||
* setWatchOnly, is not automatically considered to belong to the wallet if | |||||
* it can't be solved and signed for. | |||||
*/ | |||||
ScriptMap mapScripts GUARDED_BY(cs_KeyStore); | ScriptMap mapScripts GUARDED_BY(cs_KeyStore); | ||||
public: | public: | ||||
mutable RecursiveMutex cs_KeyStore; | mutable RecursiveMutex cs_KeyStore; | ||||
virtual bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey); | virtual bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey); | ||||
virtual bool AddKey(const CKey &key) { | virtual bool AddKey(const CKey &key) { | ||||
return AddKeyPubKey(key, key.GetPubKey()); | return AddKeyPubKey(key, key.GetPubKey()); | ||||
Show All 20 Lines |