 |
Bitcoin Core
22.99.0
P2P Digital Currency
|
Go to the documentation of this file.
14 template<
typename M,
typename K,
typename V>
17 auto it = map.find(key);
18 if (it != map.end()) {
56 std::pair<CPubKey, KeyOriginInfo> out;
58 if (ret) info = std::move(out.second);
79 for (
const auto& [output_key, spenddata] : b.
tr_spenddata) {
104 mapScripts[
id] = std::move(script);
111 if (!
GetKey(address, key)) {
121 mapKeys[pubkey.
GetID()] = key;
129 return mapKeys.count(address) > 0;
135 std::set<CKeyID> set_address;
136 for (
const auto& mi : mapKeys) {
137 set_address.insert(mi.first);
145 KeyMap::const_iterator mi = mapKeys.find(address);
146 if (mi != mapKeys.end()) {
159 mapScripts[
CScriptID(redeemScript)] = redeemScript;
166 return mapScripts.count(hash) > 0;
172 std::set<CScriptID> set_script;
173 for (
const auto& mi : mapScripts) {
174 set_script.insert(mi.first);
182 ScriptMap::const_iterator mi = mapScripts.find(hash);
183 if (mi != mapScripts.end())
185 redeemScriptOut = (*mi).second;
195 if (
auto id = std::get_if<PKHash>(&dest)) {
198 if (
auto witness_id = std::get_if<WitnessV0KeyHash>(&dest)) {
201 if (
auto script_hash = std::get_if<ScriptHash>(&dest)) {
206 if (
auto inner_witness_id = std::get_if<WitnessV0KeyHash>(&inner_dest)) {
207 return ToKeyID(*inner_witness_id);
211 if (
auto output_key = std::get_if<WitnessV1Taproot>(&dest)) {
bool LookupHelper(const M &map, const K &key, V &value)
virtual std::set< CKeyID > GetKeys() const
const SigningProvider * m_provider
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
std::map< CKeyID, CKey > keys
An interface to be implemented by keystores that support signing.
FlatSigningProvider Merge(const FlatSigningProvider &a, const FlatSigningProvider &b)
A reference to a CKey: the Hash160 of its serialized public key.
const SigningProvider & DUMMY_SIGNING_PROVIDER
virtual bool GetPubKey(const CKeyID &address, CPubKey &pubkey) const
void ImplicitlyLearnRelatedKeyScripts(const CPubKey &pubkey) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
bool GetKeyOrigin(const CKeyID &keyid, KeyOriginInfo &info) const override
virtual std::set< CScriptID > GetCScripts() const
std::map< CScriptID, CScript > scripts
bool GetTaprootSpendData(const XOnlyPubKey &output_key, TaprootSpendData &spenddata) const override
std::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
bool GetKeyOrigin(const CKeyID &keyid, KeyOriginInfo &info) const override
std::map< CKeyID, std::pair< CPubKey, KeyOriginInfo > > origins
virtual bool GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const override
virtual bool GetKeyOrigin(const CKeyID &keyid, KeyOriginInfo &info) const
static const unsigned int MAX_SCRIPT_ELEMENT_SIZE
uint256 merkle_root
The Merkle root of the script tree (0 if no scripts).
virtual bool HaveCScript(const CScriptID &hash) const override
CKeyID GetKeyForDestination(const SigningProvider &store, const CTxDestination &dest)
Return the CKeyID of the key involved in a script (if there is a unique one).
virtual bool GetTaprootSpendData(const XOnlyPubKey &output_key, TaprootSpendData &spenddata) const
virtual bool GetCScript(const CScriptID &scriptid, CScript &script) const
std::map< CKeyID, CPubKey > pubkeys
bool IsNull() const
Test whether this is the 0 key (the result of default construction).
CPubKey GetPubKey() const
Compute the public key from a private key.
Serialized script, used inside transaction inputs and outputs.
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
XOnlyPubKey internal_key
The BIP341 internal key.
bool IsCompressed() const
Check whether this is a compressed public key.
CKeyID ToKeyID(const PKHash &key_hash)
bool GetKey(const CKeyID &keyid, CKey &key) const override
An encapsulated public key.
bool GetTaprootSpendData(const XOnlyPubKey &output_key, TaprootSpendData &spenddata) const override
An encapsulated private key.
virtual bool GetKey(const CKeyID &address, CKey &keyOut) const override
bool GetPubKey(const CKeyID &keyid, CPubKey &pubkey) const override
virtual bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey)
virtual bool GetKey(const CKeyID &address, CKey &key) const
virtual bool GetCScript(const CScriptID &hash, CScript &redeemScriptOut) const override
virtual bool AddCScript(const CScript &redeemScript)
bool GetCScript(const CScriptID &scriptid, CScript &script) const override
bool GetCScript(const CScriptID &scriptid, CScript &script) const override
Map from output key to spend data.
std::map< XOnlyPubKey, TaprootSpendData > tr_spenddata
virtual bool HaveKey(const CKeyID &address) const override
RecursiveMutex cs_KeyStore
bool error(const char *fmt, const Args &... args)
bool GetPubKey(const CKeyID &keyid, CPubKey &pubkey) const override
bool GetKey(const CKeyID &keyid, CKey &key) const override
A reference to a CScript: the Hash160 of its serialization (see script.h)
bool GetPubKeyByXOnly(const XOnlyPubKey &pubkey, CPubKey &out) const
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)