0diff --git a/src/script/descriptor.cpp b/src/script/descriptor.cpp
 1index e639e494582..877d2538b2c 100644
 2--- a/src/script/descriptor.cpp
 3+++ b/src/script/descriptor.cpp
 4@@ -1056,7 +1056,7 @@ enum class ParseScriptContext {
 5 };
 6 
 7 /** Parse a key path, being passed a split list of elements (the first element is ignored). */
 8-[[nodiscard]] bool ParseKeyPath(const std::vector<Span<const char>>& split, KeyPath& out, std::optional<bool>& apostrophe, std::string& error)
 9+[[nodiscard]] bool ParseKeyPath(const std::vector<Span<const char>>& split, KeyPath& out, bool& apostrophe, std::string& error)
10 {
11     for (size_t i = 1; i < split.size(); ++i) {
12         Span<const char> elem = split[i];
13@@ -1083,7 +1083,7 @@ enum class ParseScriptContext {
14 }
15 
16 /** Parse a public key that excludes origin information. */
17-std::unique_ptr<PubkeyProvider> ParsePubkeyInner(uint32_t key_exp_index, const Span<const char>& sp, ParseScriptContext ctx, FlatSigningProvider& out, std::optional<bool>& apostrophe, std::string& error)
18+std::unique_ptr<PubkeyProvider> ParsePubkeyInner(uint32_t key_exp_index, const Span<const char>& sp, ParseScriptContext ctx, FlatSigningProvider& out, bool& apostrophe, std::string& error)
19 {
20     using namespace spanparsing;
21 
22@@ -1149,7 +1149,7 @@ std::unique_ptr<PubkeyProvider> ParsePubkeyInner(uint32_t key_exp_index, const S
23         extpubkey = extkey.Neuter();
24         out.keys.emplace(extpubkey.pubkey.GetID(), extkey.key);
25     }
26-    return std::make_unique<BIP32PubkeyProvider>(key_exp_index, extpubkey, std::move(path), type, apostrophe.value_or(false));
27+    return std::make_unique<BIP32PubkeyProvider>(key_exp_index, extpubkey, std::move(path), type, apostrophe);
28 }
29 
30 /** Parse a public key including origin information (if enabled). */
31@@ -1163,7 +1163,7 @@ std::unique_ptr<PubkeyProvider> ParsePubkey(uint32_t key_exp_index, const Span<c
32         return nullptr;
33     }
34     // This is set if either the origin or path suffix contains a hardened deriviation.
35-    std::optional<bool> apostrophe;
36+    bool apostrophe = false;
37     if (origin_split.size() == 1) {
38         return ParsePubkeyInner(key_exp_index, origin_split[0], ctx, out, apostrophe, error);
39     }
40@@ -1190,7 +1190,7 @@ std::unique_ptr<PubkeyProvider> ParsePubkey(uint32_t key_exp_index, const Span<c
41     if (!ParseKeyPath(slash_split, info.path, apostrophe, error)) return nullptr;
42     auto provider = ParsePubkeyInner(key_exp_index, origin_split[1], ctx, out, apostrophe, error);
43     if (!provider) return nullptr;
44-    return std::make_unique<OriginPubkeyProvider>(key_exp_index, std::move(info), std::move(provider), apostrophe.value_or(false));
45+    return std::make_unique<OriginPubkeyProvider>(key_exp_index, std::move(info), std::move(provider), apostrophe);
46 }
47 
48 std::unique_ptr<PubkeyProvider> InferPubkey(const CPubKey& pubkey, ParseScriptContext, const SigningProvider& provider)