Changeset View
Changeset View
Standalone View
Standalone View
src/script/descriptor.cpp
Show First 20 Lines • Show All 287 Lines • ▼ Show 20 Lines | bool GetPubKey(int pos, const SigningProvider &arg, CPubKey &key, | ||||
info.path.clear(); | info.path.clear(); | ||||
CKeyID keyid = m_pubkey.GetID(); | CKeyID keyid = m_pubkey.GetID(); | ||||
std::copy(keyid.begin(), keyid.begin() + sizeof(info.fingerprint), | std::copy(keyid.begin(), keyid.begin() + sizeof(info.fingerprint), | ||||
info.fingerprint); | info.fingerprint); | ||||
return true; | return true; | ||||
} | } | ||||
bool IsRange() const override { return false; } | bool IsRange() const override { return false; } | ||||
size_t GetSize() const override { return m_pubkey.size(); } | size_t GetSize() const override { return m_pubkey.size(); } | ||||
std::string ToString() const override { | std::string ToString() const override { return HexStr(m_pubkey); } | ||||
return HexStr(m_pubkey.begin(), m_pubkey.end()); | |||||
} | |||||
bool ToPrivateString(const SigningProvider &arg, | bool ToPrivateString(const SigningProvider &arg, | ||||
std::string &ret) const override { | std::string &ret) const override { | ||||
CKey key; | CKey key; | ||||
if (!arg.GetKey(m_pubkey.GetID(), key)) { | if (!arg.GetKey(m_pubkey.GetID(), key)) { | ||||
return false; | return false; | ||||
} | } | ||||
ret = EncodeSecret(key); | ret = EncodeSecret(key); | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 437 Lines • ▼ Show 20 Lines | public: | ||||
bool IsSingleType() const final { return true; } | bool IsSingleType() const final { return true; } | ||||
}; | }; | ||||
/** A parsed raw(H) descriptor. */ | /** A parsed raw(H) descriptor. */ | ||||
class RawDescriptor final : public DescriptorImpl { | class RawDescriptor final : public DescriptorImpl { | ||||
const CScript m_script; | const CScript m_script; | ||||
protected: | protected: | ||||
std::string ToStringExtra() const override { | std::string ToStringExtra() const override { return HexStr(m_script); } | ||||
return HexStr(m_script.begin(), m_script.end()); | |||||
} | |||||
std::vector<CScript> MakeScripts(const std::vector<CPubKey> &, | std::vector<CScript> MakeScripts(const std::vector<CPubKey> &, | ||||
const CScript *, | const CScript *, | ||||
FlatSigningProvider &) const override { | FlatSigningProvider &) const override { | ||||
return Vector(m_script); | return Vector(m_script); | ||||
} | } | ||||
public: | public: | ||||
RawDescriptor(CScript script) | RawDescriptor(CScript script) | ||||
▲ Show 20 Lines • Show All 592 Lines • Show Last 20 Lines |