scripted-diff: rename DescriptorImpl m_script_arg to m_subdescriptor_arg

-BEGIN VERIFY SCRIPT-
sed -i -e 's/m_script_arg/m_subdescriptor_arg/g' src/script/descriptor.cpp
-END VERIFY SCRIPT-
This commit is contained in:
Sjors Provoost 2018-12-12 09:45:55 +01:00
parent 7275365c9b
commit 2290269759
No known key found for this signature in database
GPG key ID: 57FF9BDBCC301009

View file

@ -210,7 +210,7 @@ class DescriptorImpl : public Descriptor
//! Public key arguments for this descriptor (size 1 for PK, PKH, WPKH; any size of Multisig).
const std::vector<std::unique_ptr<PubkeyProvider>> m_pubkey_args;
//! The sub-descriptor argument (nullptr for everything but SH and WSH).
const std::unique_ptr<DescriptorImpl> m_script_arg;
const std::unique_ptr<DescriptorImpl> m_subdescriptor_arg;
//! The string name of the descriptor function.
const std::string m_name;
@ -221,10 +221,10 @@ protected:
/** A helper function to construct the scripts for this descriptor.
*
* This function is invoked once for every CScript produced by evaluating
* m_script_arg, or just once in case m_script_arg is nullptr.
* m_subdescriptor_arg, or just once in case m_subdescriptor_arg is nullptr.
* @param pubkeys The evaluations of the m_pubkey_args field.
* @param script The evaluation of m_script_arg (or nullptr when m_script_arg is nullptr).
* @param script The evaluation of m_subdescriptor_arg (or nullptr when m_subdescriptor_arg is nullptr).
* @param out A FlatSigningProvider to put scripts or public keys in that are necessary to the solver.
* The script and pubkeys argument to this function are automatically added.
* @return A vector with scriptPubKeys for this descriptor.
@ -232,12 +232,12 @@ protected:
virtual std::vector<CScript> MakeScripts(const std::vector<CPubKey>& pubkeys, const CScript* script, FlatSigningProvider& out) const = 0;
public:
DescriptorImpl(std::vector<std::unique_ptr<PubkeyProvider>> pubkeys, std::unique_ptr<DescriptorImpl> script, const std::string& name) : m_pubkey_args(std::move(pubkeys)), m_script_arg(std::move(script)), m_name(name) {}
DescriptorImpl(std::vector<std::unique_ptr<PubkeyProvider>> pubkeys, std::unique_ptr<DescriptorImpl> script, const std::string& name) : m_pubkey_args(std::move(pubkeys)), m_subdescriptor_arg(std::move(script)), m_name(name) {}
bool IsSolvable() const override
{
if (m_script_arg) {
if (!m_script_arg->IsSolvable()) return false;
if (m_subdescriptor_arg) {
if (!m_subdescriptor_arg->IsSolvable()) return false;
}
return true;
}
@ -247,8 +247,8 @@ public:
for (const auto& pubkey : m_pubkey_args) {
if (pubkey->IsRange()) return true;
}
if (m_script_arg) {
if (m_script_arg->IsRange()) return true;
if (m_subdescriptor_arg) {
if (m_subdescriptor_arg->IsRange()) return true;
}
return false;
}
@ -268,10 +268,10 @@ public:
}
ret += std::move(tmp);
}
if (m_script_arg) {
if (m_subdescriptor_arg) {
if (pos++) ret += ",";
std::string tmp;
if (!m_script_arg->ToStringHelper(arg, tmp, priv)) return false;
if (!m_subdescriptor_arg->ToStringHelper(arg, tmp, priv)) return false;
ret += std::move(tmp);
}
out = std::move(ret) + ")";
@ -311,9 +311,9 @@ public:
}
}
std::vector<CScript> subscripts;
if (m_script_arg) {
if (m_subdescriptor_arg) {
FlatSigningProvider subprovider;
if (!m_script_arg->ExpandHelper(pos, arg, cache_read, subscripts, subprovider, cache_write)) return false;
if (!m_subdescriptor_arg->ExpandHelper(pos, arg, cache_read, subscripts, subprovider, cache_write)) return false;
out = Merge(out, subprovider);
}
@ -324,7 +324,7 @@ public:
out.origins.emplace(entry.first.GetID(), std::move(entry.second));
out.pubkeys.emplace(entry.first.GetID(), entry.first);
}
if (m_script_arg) {
if (m_subdescriptor_arg) {
for (const auto& subscript : subscripts) {
out.scripts.emplace(CScriptID(subscript), subscript);
std::vector<CScript> addscripts = MakeScripts(pubkeys, &subscript, out);