Skip to content

Commit fa2125e

Browse files
author
MarcoFalke
committed
Remove unused IsSingleKey
1 parent fab5e2a commit fa2125e

File tree

3 files changed

+0
-19
lines changed

3 files changed

+0
-19
lines changed

src/script/descriptor.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,6 @@ class AddressDescriptor final : public DescriptorImpl
799799
return OutputTypeFromDestination(m_destination);
800800
}
801801
bool IsSingleType() const final { return true; }
802-
bool IsSingleKey() const final { return false; }
803802
bool ToPrivateString(const SigningProvider& arg, std::string& out) const final { return false; }
804803

805804
std::optional<int64_t> ScriptSize() const override { return GetScriptForDestination(m_destination).size(); }
@@ -827,7 +826,6 @@ class RawDescriptor final : public DescriptorImpl
827826
return OutputTypeFromDestination(dest);
828827
}
829828
bool IsSingleType() const final { return true; }
830-
bool IsSingleKey() const final { return false; }
831829
bool ToPrivateString(const SigningProvider& arg, std::string& out) const final { return false; }
832830

833831
std::optional<int64_t> ScriptSize() const override { return m_script.size(); }
@@ -856,7 +854,6 @@ class PKDescriptor final : public DescriptorImpl
856854
public:
857855
PKDescriptor(std::unique_ptr<PubkeyProvider> prov, bool xonly = false) : DescriptorImpl(Vector(std::move(prov)), "pk"), m_xonly(xonly) {}
858856
bool IsSingleType() const final { return true; }
859-
bool IsSingleKey() const final { return true; }
860857

861858
std::optional<int64_t> ScriptSize() const override {
862859
return 1 + (m_xonly ? 32 : m_pubkey_args[0]->GetSize()) + 1;
@@ -892,7 +889,6 @@ class PKHDescriptor final : public DescriptorImpl
892889
PKHDescriptor(std::unique_ptr<PubkeyProvider> prov) : DescriptorImpl(Vector(std::move(prov)), "pkh") {}
893890
std::optional<OutputType> GetOutputType() const override { return OutputType::LEGACY; }
894891
bool IsSingleType() const final { return true; }
895-
bool IsSingleKey() const final { return true; }
896892

897893
std::optional<int64_t> ScriptSize() const override { return 1 + 1 + 1 + 20 + 1 + 1; }
898894

@@ -926,7 +922,6 @@ class WPKHDescriptor final : public DescriptorImpl
926922
WPKHDescriptor(std::unique_ptr<PubkeyProvider> prov) : DescriptorImpl(Vector(std::move(prov)), "wpkh") {}
927923
std::optional<OutputType> GetOutputType() const override { return OutputType::BECH32; }
928924
bool IsSingleType() const final { return true; }
929-
bool IsSingleKey() const final { return true; }
930925

931926
std::optional<int64_t> ScriptSize() const override { return 1 + 1 + 20; }
932927

@@ -968,7 +963,6 @@ class ComboDescriptor final : public DescriptorImpl
968963
public:
969964
ComboDescriptor(std::unique_ptr<PubkeyProvider> prov) : DescriptorImpl(Vector(std::move(prov)), "combo") {}
970965
bool IsSingleType() const final { return false; }
971-
bool IsSingleKey() const final { return true; }
972966
std::unique_ptr<DescriptorImpl> Clone() const override
973967
{
974968
return std::make_unique<ComboDescriptor>(m_pubkey_args.at(0)->Clone());
@@ -993,7 +987,6 @@ class MultisigDescriptor final : public DescriptorImpl
993987
public:
994988
MultisigDescriptor(int threshold, std::vector<std::unique_ptr<PubkeyProvider>> providers, bool sorted = false) : DescriptorImpl(std::move(providers), sorted ? "sortedmulti" : "multi"), m_threshold(threshold), m_sorted(sorted) {}
995989
bool IsSingleType() const final { return true; }
996-
bool IsSingleKey() const final { return false; }
997990

998991
std::optional<int64_t> ScriptSize() const override {
999992
const auto n_keys = m_pubkey_args.size();
@@ -1045,7 +1038,6 @@ class MultiADescriptor final : public DescriptorImpl
10451038
public:
10461039
MultiADescriptor(int threshold, std::vector<std::unique_ptr<PubkeyProvider>> providers, bool sorted = false) : DescriptorImpl(std::move(providers), sorted ? "sortedmulti_a" : "multi_a"), m_threshold(threshold), m_sorted(sorted) {}
10471040
bool IsSingleType() const final { return true; }
1048-
bool IsSingleKey() const final { return false; }
10491041

10501042
std::optional<int64_t> ScriptSize() const override {
10511043
const auto n_keys = m_pubkey_args.size();
@@ -1092,7 +1084,6 @@ class SHDescriptor final : public DescriptorImpl
10921084
return OutputType::LEGACY;
10931085
}
10941086
bool IsSingleType() const final { return true; }
1095-
bool IsSingleKey() const final { return m_subdescriptor_args[0]->IsSingleKey(); }
10961087

10971088
std::optional<int64_t> ScriptSize() const override { return 1 + 1 + 20 + 1; }
10981089

@@ -1134,7 +1125,6 @@ class WSHDescriptor final : public DescriptorImpl
11341125
WSHDescriptor(std::unique_ptr<DescriptorImpl> desc) : DescriptorImpl({}, std::move(desc), "wsh") {}
11351126
std::optional<OutputType> GetOutputType() const override { return OutputType::BECH32; }
11361127
bool IsSingleType() const final { return true; }
1137-
bool IsSingleKey() const final { return m_subdescriptor_args[0]->IsSingleKey(); }
11381128

11391129
std::optional<int64_t> ScriptSize() const override { return 1 + 1 + 32; }
11401130

@@ -1212,7 +1202,6 @@ class TRDescriptor final : public DescriptorImpl
12121202
}
12131203
std::optional<OutputType> GetOutputType() const override { return OutputType::BECH32M; }
12141204
bool IsSingleType() const final { return true; }
1215-
bool IsSingleKey() const final { return false; }
12161205

12171206
std::optional<int64_t> ScriptSize() const override { return 1 + 1 + 32; }
12181207

@@ -1340,7 +1329,6 @@ class MiniscriptDescriptor final : public DescriptorImpl
13401329

13411330
bool IsSolvable() const override { return true; }
13421331
bool IsSingleType() const final { return true; }
1343-
bool IsSingleKey() const final { return false; }
13441332

13451333
std::optional<int64_t> ScriptSize() const override { return m_node->ScriptSize(); }
13461334

@@ -1380,7 +1368,6 @@ class RawTRDescriptor final : public DescriptorImpl
13801368
RawTRDescriptor(std::unique_ptr<PubkeyProvider> output_key) : DescriptorImpl(Vector(std::move(output_key)), "rawtr") {}
13811369
std::optional<OutputType> GetOutputType() const override { return OutputType::BECH32M; }
13821370
bool IsSingleType() const final { return true; }
1383-
bool IsSingleKey() const final { return false; }
13841371

13851372
std::optional<int64_t> ScriptSize() const override { return 1 + 1 + 32; }
13861373

src/script/descriptor.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,6 @@ struct Descriptor {
111111
/** Whether this descriptor will return one scriptPubKey or multiple (aka is or is not combo) */
112112
virtual bool IsSingleType() const = 0;
113113

114-
/** Whether this descriptor only produces single key scripts (i.e. pk(), pkh(), wpkh(), sh() and wsh() nested of those, and combo())
115-
* TODO: Remove this method once legacy wallets are removed as it is only necessary for importmulti.
116-
*/
117-
virtual bool IsSingleKey() const = 0;
118-
119114
/** Convert the descriptor to a private string. This fails if the provided provider does not have the relevant private keys. */
120115
virtual bool ToPrivateString(const SigningProvider& provider, std::string& out) const = 0;
121116

src/wallet/test/walletload_tests.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class DummyDescriptor final : public Descriptor {
2626
bool IsRange() const override { return false; }
2727
bool IsSolvable() const override { return false; }
2828
bool IsSingleType() const override { return true; }
29-
bool IsSingleKey() const override { return true; }
3029
bool ToPrivateString(const SigningProvider& provider, std::string& out) const override { return false; }
3130
bool ToNormalizedString(const SigningProvider& provider, std::string& out, const DescriptorCache* cache = nullptr) const override { return false; }
3231
bool Expand(int pos, const SigningProvider& provider, std::vector<CScript>& output_scripts, FlatSigningProvider& out, DescriptorCache* write_cache = nullptr) const override { return false; };

0 commit comments

Comments
 (0)