Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/scriptpubkeyman.h
Show First 20 Lines • Show All 233 Lines • ▼ Show 20 Lines | public: | ||||
virtual unsigned int GetKeyPoolSize() const { return 0; } | virtual unsigned int GetKeyPoolSize() const { return 0; } | ||||
virtual int64_t GetTimeFirstKey() const { return 0; } | virtual int64_t GetTimeFirstKey() const { return 0; } | ||||
virtual const CKeyMetadata *GetMetadata(const CTxDestination &dest) const { | virtual const CKeyMetadata *GetMetadata(const CTxDestination &dest) const { | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
virtual const SigningProvider * | virtual std::unique_ptr<SigningProvider> | ||||
GetSigningProvider(const CScript &script) const { | GetSigningProvider(const CScript &script) const { | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
/** | /** | ||||
* Whether this ScriptPubKeyMan can provide a SigningProvider (via | * Whether this ScriptPubKeyMan can provide a SigningProvider (via | ||||
* GetSigningProvider) that, combined with sigdata, can produce a valid | * GetSigningProvider) that, combined with sigdata, can produce a valid | ||||
* signature. | * signature. | ||||
▲ Show 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | public: | ||||
unsigned int GetKeyPoolSize() const override; | unsigned int GetKeyPoolSize() const override; | ||||
int64_t GetTimeFirstKey() const override; | int64_t GetTimeFirstKey() const override; | ||||
const CKeyMetadata *GetMetadata(const CTxDestination &dest) const override; | const CKeyMetadata *GetMetadata(const CTxDestination &dest) const override; | ||||
bool CanGetAddresses(bool internal = false) override; | bool CanGetAddresses(bool internal = false) override; | ||||
const SigningProvider * | std::unique_ptr<SigningProvider> | ||||
GetSigningProvider(const CScript &script) const override; | GetSigningProvider(const CScript &script) const override; | ||||
bool CanProvide(const CScript &script, SignatureData &sigdata) override; | bool CanProvide(const CScript &script, SignatureData &sigdata) override; | ||||
uint256 GetID() const override; | uint256 GetID() const override; | ||||
// Map from Key ID to key metadata. | // Map from Key ID to key metadata. | ||||
std::map<CKeyID, CKeyMetadata> mapKeyMetadata GUARDED_BY(cs_KeyStore); | std::map<CKeyID, CKeyMetadata> mapKeyMetadata GUARDED_BY(cs_KeyStore); | ||||
▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | void MarkReserveKeysAsUsed(int64_t keypool_id) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore); | EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore); | ||||
const std::map<CKeyID, int64_t> &GetAllReserveKeys() const { | const std::map<CKeyID, int64_t> &GetAllReserveKeys() const { | ||||
return m_pool_key_to_index; | return m_pool_key_to_index; | ||||
} | } | ||||
std::set<CKeyID> GetKeys() const override; | std::set<CKeyID> GetKeys() const override; | ||||
}; | }; | ||||
/** Wraps a LegacyScriptPubKeyMan so that it can be returned in a new unique_ptr | |||||
*/ | |||||
class LegacySigningProvider : public SigningProvider { | |||||
private: | |||||
const LegacyScriptPubKeyMan &m_spk_man; | |||||
public: | |||||
LegacySigningProvider(const LegacyScriptPubKeyMan &spk_man) | |||||
: m_spk_man(spk_man) {} | |||||
bool GetCScript(const CScriptID &scriptid, CScript &script) const override { | |||||
return m_spk_man.GetCScript(scriptid, script); | |||||
} | |||||
bool HaveCScript(const CScriptID &scriptid) const override { | |||||
return m_spk_man.HaveCScript(scriptid); | |||||
} | |||||
bool GetPubKey(const CKeyID &address, CPubKey &pubkey) const override { | |||||
return m_spk_man.GetPubKey(address, pubkey); | |||||
} | |||||
bool GetKey(const CKeyID &address, CKey &key) const override { | |||||
return m_spk_man.GetKey(address, key); | |||||
} | |||||
bool HaveKey(const CKeyID &address) const override { | |||||
return m_spk_man.HaveKey(address); | |||||
} | |||||
bool GetKeyOrigin(const CKeyID &keyid, KeyOriginInfo &info) const override { | |||||
return m_spk_man.GetKeyOrigin(keyid, info); | |||||
} | |||||
}; | |||||
#endif // BITCOIN_WALLET_SCRIPTPUBKEYMAN_H | #endif // BITCOIN_WALLET_SCRIPTPUBKEYMAN_H |