Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/scriptpubkeyman.h
Show First 20 Lines • Show All 237 Lines • ▼ Show 20 Lines | public: | ||||
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 std::unique_ptr<SigningProvider> | virtual std::unique_ptr<SigningProvider> | ||||
GetSigningProvider(const CScript &script) const { | GetSolvingProvider(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 | * GetSolvingProvider) that, combined with sigdata, can produce solving | ||||
* signature. | * data. | ||||
*/ | */ | ||||
virtual bool CanProvide(const CScript &script, SignatureData &sigdata) { | virtual bool CanProvide(const CScript &script, SignatureData &sigdata) { | ||||
return false; | return false; | ||||
} | } | ||||
/** | /** | ||||
* Creates new signatures and adds them to the transaction. Returns whether | * Creates new signatures and adds them to the transaction. Returns whether | ||||
* all inputs were signed | * all inputs were signed | ||||
▲ Show 20 Lines • Show All 179 Lines • ▼ Show 20 Lines | public: | ||||
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; | ||||
std::unique_ptr<SigningProvider> | std::unique_ptr<SigningProvider> | ||||
GetSigningProvider(const CScript &script) const override; | GetSolvingProvider(const CScript &script) const override; | ||||
bool CanProvide(const CScript &script, SignatureData &sigdata) override; | bool CanProvide(const CScript &script, SignatureData &sigdata) override; | ||||
bool | bool | ||||
SignTransaction(CMutableTransaction &tx, | SignTransaction(CMutableTransaction &tx, | ||||
const std::map<COutPoint, Coin> &coins, SigHashType sighash, | const std::map<COutPoint, Coin> &coins, SigHashType sighash, | ||||
std::map<int, std::string> &input_errors) const override; | std::map<int, std::string> &input_errors) const override; | ||||
SigningResult SignMessage(const std::string &message, const PKHash &pkhash, | SigningResult SignMessage(const std::string &message, const PKHash &pkhash, | ||||
▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | public: | ||||
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 | * Wraps a LegacyScriptPubKeyMan so that it can be returned in a new unique_ptr. | ||||
* Does not provide privkeys. | |||||
*/ | */ | ||||
class LegacySigningProvider : public SigningProvider { | class LegacySigningProvider : public SigningProvider { | ||||
private: | private: | ||||
const LegacyScriptPubKeyMan &m_spk_man; | const LegacyScriptPubKeyMan &m_spk_man; | ||||
public: | public: | ||||
LegacySigningProvider(const LegacyScriptPubKeyMan &spk_man) | LegacySigningProvider(const LegacyScriptPubKeyMan &spk_man) | ||||
: m_spk_man(spk_man) {} | : m_spk_man(spk_man) {} | ||||
bool GetCScript(const CScriptID &scriptid, CScript &script) const override { | bool GetCScript(const CScriptID &scriptid, CScript &script) const override { | ||||
return m_spk_man.GetCScript(scriptid, script); | return m_spk_man.GetCScript(scriptid, script); | ||||
} | } | ||||
bool HaveCScript(const CScriptID &scriptid) const override { | bool HaveCScript(const CScriptID &scriptid) const override { | ||||
return m_spk_man.HaveCScript(scriptid); | return m_spk_man.HaveCScript(scriptid); | ||||
} | } | ||||
bool GetPubKey(const CKeyID &address, CPubKey &pubkey) const override { | bool GetPubKey(const CKeyID &address, CPubKey &pubkey) const override { | ||||
return m_spk_man.GetPubKey(address, pubkey); | return m_spk_man.GetPubKey(address, pubkey); | ||||
} | } | ||||
bool GetKey(const CKeyID &address, CKey &key) const override { | bool GetKey(const CKeyID &address, CKey &key) const override { | ||||
return m_spk_man.GetKey(address, key); | return false; | ||||
} | |||||
bool HaveKey(const CKeyID &address) const override { | |||||
return m_spk_man.HaveKey(address); | |||||
} | } | ||||
bool HaveKey(const CKeyID &address) const override { return false; } | |||||
bool GetKeyOrigin(const CKeyID &keyid, KeyOriginInfo &info) const override { | bool GetKeyOrigin(const CKeyID &keyid, KeyOriginInfo &info) const override { | ||||
return m_spk_man.GetKeyOrigin(keyid, info); | return m_spk_man.GetKeyOrigin(keyid, info); | ||||
} | } | ||||
}; | }; | ||||
#endif // BITCOIN_WALLET_SCRIPTPUBKEYMAN_H | #endif // BITCOIN_WALLET_SCRIPTPUBKEYMAN_H |