Changeset View
Changeset View
Standalone View
Standalone View
src/script/descriptor.cpp
Show First 20 Lines • Show All 305 Lines • ▼ Show 20 Lines | bool IsRange() const final { | ||||
if (m_script_arg) { | if (m_script_arg) { | ||||
if (m_script_arg->IsRange()) { | if (m_script_arg->IsRange()) { | ||||
return true; | return true; | ||||
} | } | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
bool ToPrivateString(const SigningProvider &arg, | bool ToStringHelper(const SigningProvider *arg, std::string &out, | ||||
std::string &out) const final { | bool priv) const { | ||||
std::string extra = ToStringExtra(); | std::string extra = ToStringExtra(); | ||||
size_t pos = extra.size() > 0 ? 1 : 0; | size_t pos = extra.size() > 0 ? 1 : 0; | ||||
std::string ret = m_name + "(" + extra; | std::string ret = m_name + "(" + extra; | ||||
for (const auto &pubkey : m_pubkey_args) { | for (const auto &pubkey : m_pubkey_args) { | ||||
if (pos++) { | if (pos++) { | ||||
ret += ","; | ret += ","; | ||||
} | } | ||||
std::string tmp; | std::string tmp; | ||||
if (!pubkey->ToPrivateString(arg, tmp)) { | if (priv) { | ||||
if (!pubkey->ToPrivateString(*arg, tmp)) { | |||||
return false; | return false; | ||||
} | } | ||||
} else { | |||||
tmp = pubkey->ToString(); | |||||
} | |||||
ret += std::move(tmp); | ret += std::move(tmp); | ||||
} | } | ||||
if (m_script_arg) { | if (m_script_arg) { | ||||
if (pos++) { | if (pos++) { | ||||
ret += ","; | ret += ","; | ||||
} | } | ||||
std::string tmp; | std::string tmp; | ||||
if (!m_script_arg->ToPrivateString(arg, tmp)) { | if (!m_script_arg->ToStringHelper(arg, tmp, priv)) { | ||||
return false; | return false; | ||||
} | } | ||||
ret += std::move(tmp); | ret += std::move(tmp); | ||||
} | } | ||||
out = std::move(ret) + ")"; | out = std::move(ret) + ")"; | ||||
return true; | return true; | ||||
} | } | ||||
std::string ToString() const final { | std::string ToString() const final { | ||||
std::string extra = ToStringExtra(); | std::string ret; | ||||
size_t pos = extra.size() > 0 ? 1 : 0; | ToStringHelper(nullptr, ret, false); | ||||
std::string ret = m_name + "(" + extra; | return ret; | ||||
for (const auto &pubkey : m_pubkey_args) { | |||||
if (pos++) { | |||||
ret += ","; | |||||
} | |||||
ret += pubkey->ToString(); | |||||
} | |||||
if (m_script_arg) { | |||||
if (pos++) { | |||||
ret += ","; | |||||
} | |||||
ret += m_script_arg->ToString(); | |||||
} | } | ||||
return std::move(ret) + ")"; | |||||
bool ToPrivateString(const SigningProvider &arg, | |||||
std::string &out) const override final { | |||||
return ToStringHelper(&arg, out, true); | |||||
} | } | ||||
bool Expand(int pos, const SigningProvider &arg, | bool Expand(int pos, const SigningProvider &arg, | ||||
std::vector<CScript> &output_scripts, | std::vector<CScript> &output_scripts, | ||||
FlatSigningProvider &out) const final { | FlatSigningProvider &out) const final { | ||||
std::vector<std::pair<CPubKey, KeyOriginInfo>> entries; | std::vector<std::pair<CPubKey, KeyOriginInfo>> entries; | ||||
entries.reserve(m_pubkey_args.size()); | entries.reserve(m_pubkey_args.size()); | ||||
▲ Show 20 Lines • Show All 526 Lines • Show Last 20 Lines |