From 57e980d13ca488031bde6ef197cf34d493d36796 Mon Sep 17 00:00:00 2001 From: fanquake Date: Mon, 15 Mar 2021 10:41:30 +0800 Subject: scripted-diff: remove Optional & nullopt -BEGIN VERIFY SCRIPT- git rm src/optional.h sed -i -e 's/Optional/d' src/test/fuzz/autofile.cpp src/test/fuzz/buffered_file.cpp src/test/fuzz/node_eviction.cpp sed -i -e 's/#include /#include /g' $(git grep -l '#include ' src) -END VERIFY SCRIPT- --- src/script/descriptor.cpp | 18 +++++++++--------- src/script/descriptor.h | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/script') diff --git a/src/script/descriptor.cpp b/src/script/descriptor.cpp index 889cb4f06e..cfe1da12e8 100644 --- a/src/script/descriptor.cpp +++ b/src/script/descriptor.cpp @@ -632,7 +632,7 @@ public: } } - Optional GetOutputType() const override { return nullopt; } + std::optional GetOutputType() const override { return std::nullopt; } }; /** A parsed addr(A) descriptor. */ @@ -646,7 +646,7 @@ public: AddressDescriptor(CTxDestination destination) : DescriptorImpl({}, {}, "addr"), m_destination(std::move(destination)) {} bool IsSolvable() const final { return false; } - Optional GetOutputType() const override + std::optional GetOutputType() const override { switch (m_destination.index()) { case 1 /* PKHash */: @@ -655,7 +655,7 @@ public: case 4 /* WitnessV0KeyHash */: case 5 /* WitnessUnknown */: return OutputType::BECH32; case 0 /* CNoDestination */: - default: return nullopt; + default: return std::nullopt; } } bool IsSingleType() const final { return true; } @@ -672,7 +672,7 @@ public: RawDescriptor(CScript script) : DescriptorImpl({}, {}, "raw"), m_script(std::move(script)) {} bool IsSolvable() const final { return false; } - Optional GetOutputType() const override + std::optional GetOutputType() const override { CTxDestination dest; ExtractDestination(m_script, dest); @@ -683,7 +683,7 @@ public: case 4 /* WitnessV0KeyHash */: case 5 /* WitnessUnknown */: return OutputType::BECH32; case 0 /* CNoDestination */: - default: return nullopt; + default: return std::nullopt; } } bool IsSingleType() const final { return true; } @@ -711,7 +711,7 @@ protected: } public: PKHDescriptor(std::unique_ptr prov) : DescriptorImpl(Vector(std::move(prov)), {}, "pkh") {} - Optional GetOutputType() const override { return OutputType::LEGACY; } + std::optional GetOutputType() const override { return OutputType::LEGACY; } bool IsSingleType() const final { return true; } }; @@ -727,7 +727,7 @@ protected: } public: WPKHDescriptor(std::unique_ptr prov) : DescriptorImpl(Vector(std::move(prov)), {}, "wpkh") {} - Optional GetOutputType() const override { return OutputType::BECH32; } + std::optional GetOutputType() const override { return OutputType::BECH32; } bool IsSingleType() const final { return true; } }; @@ -783,7 +783,7 @@ protected: public: SHDescriptor(std::unique_ptr desc) : DescriptorImpl({}, std::move(desc), "sh") {} - Optional GetOutputType() const override + std::optional GetOutputType() const override { assert(m_subdescriptor_arg); if (m_subdescriptor_arg->GetOutputType() == OutputType::BECH32) return OutputType::P2SH_SEGWIT; @@ -799,7 +799,7 @@ protected: std::vector MakeScripts(const std::vector&, const CScript* script, FlatSigningProvider&) const override { return Vector(GetScriptForDestination(WitnessV0ScriptHash(*script))); } public: WSHDescriptor(std::unique_ptr desc) : DescriptorImpl({}, std::move(desc), "wsh") {} - Optional GetOutputType() const override { return OutputType::BECH32; } + std::optional GetOutputType() const override { return OutputType::BECH32; } bool IsSingleType() const final { return true; } }; diff --git a/src/script/descriptor.h b/src/script/descriptor.h index 46d51fa587..c8d9efb11f 100644 --- a/src/script/descriptor.h +++ b/src/script/descriptor.h @@ -5,7 +5,7 @@ #ifndef BITCOIN_SCRIPT_DESCRIPTOR_H #define BITCOIN_SCRIPT_DESCRIPTOR_H -#include +#include #include #include