@@ -181,7 +181,7 @@ struct PubkeyProvider
181181 virtual bool ToPrivateString (const SigningProvider& arg, std::string& out) const = 0;
182182
183183 /* * Get the descriptor string form with the xpub at the last hardened derivation */
184- virtual bool ToNormalizedString (const SigningProvider& arg, std::string& out, bool priv ) const = 0;
184+ virtual bool ToNormalizedString (const SigningProvider& arg, std::string& out) const = 0;
185185
186186 /* * Derive a private key, if private data is available in arg. */
187187 virtual bool GetPrivKey (int pos, const SigningProvider& arg, CKey& key) const = 0;
@@ -216,10 +216,10 @@ class OriginPubkeyProvider final : public PubkeyProvider
216216 ret = " [" + OriginString () + " ]" + std::move (sub);
217217 return true ;
218218 }
219- bool ToNormalizedString (const SigningProvider& arg, std::string& ret, bool priv ) const override
219+ bool ToNormalizedString (const SigningProvider& arg, std::string& ret) const override
220220 {
221221 std::string sub;
222- if (!m_provider->ToNormalizedString (arg, sub, priv )) return false ;
222+ if (!m_provider->ToNormalizedString (arg, sub)) return false ;
223223 // If m_provider is a BIP32PubkeyProvider, we may get a string formatted like a OriginPubkeyProvider
224224 // In that case, we need to strip out the leading square bracket and fingerprint from the substring,
225225 // and append that to our own origin string.
@@ -263,9 +263,8 @@ class ConstPubkeyProvider final : public PubkeyProvider
263263 ret = EncodeSecret (key);
264264 return true ;
265265 }
266- bool ToNormalizedString (const SigningProvider& arg, std::string& ret, bool priv ) const override
266+ bool ToNormalizedString (const SigningProvider& arg, std::string& ret) const override
267267 {
268- if (priv) return ToPrivateString (arg, ret);
269268 ret = ToString ();
270269 return true ;
271270 }
@@ -413,11 +412,10 @@ class BIP32PubkeyProvider final : public PubkeyProvider
413412 }
414413 return true ;
415414 }
416- bool ToNormalizedString (const SigningProvider& arg, std::string& out, bool priv ) const override
415+ bool ToNormalizedString (const SigningProvider& arg, std::string& out) const override
417416 {
418417 // For hardened derivation type, just return the typical string, nothing to normalize
419418 if (m_derive == DeriveType::HARDENED) {
420- if (priv) return ToPrivateString (arg, out);
421419 out = ToString ();
422420 return true ;
423421 }
@@ -430,7 +428,6 @@ class BIP32PubkeyProvider final : public PubkeyProvider
430428 }
431429 // Either no derivation or all unhardened derivation
432430 if (i == -1 ) {
433- if (priv) return ToPrivateString (arg, out);
434431 out = ToString ();
435432 return true ;
436433 }
@@ -456,7 +453,7 @@ class BIP32PubkeyProvider final : public PubkeyProvider
456453 }
457454 // Build the string
458455 std::string origin_str = HexStr (origin.fingerprint ) + FormatHDKeypath (origin.path );
459- out = " [" + origin_str + " ]" + (priv ? EncodeExtKey (xprv) : EncodeExtPubKey (xprv.Neuter () )) + FormatHDKeypath (end_path);
456+ out = " [" + origin_str + " ]" + EncodeExtPubKey (xprv.Neuter ()) + FormatHDKeypath (end_path);
460457 if (IsRange ()) {
461458 out += " /*" ;
462459 assert (m_derive == DeriveType::UNHARDENED);
@@ -550,7 +547,7 @@ class DescriptorImpl : public Descriptor
550547 if (pos++) ret += " ," ;
551548 std::string tmp;
552549 if (normalized) {
553- if (!pubkey->ToNormalizedString (*arg, tmp, priv )) return false ;
550+ if (!pubkey->ToNormalizedString (*arg, tmp)) return false ;
554551 } else if (priv) {
555552 if (!pubkey->ToPrivateString (*arg, tmp)) return false ;
556553 } else {
@@ -579,9 +576,9 @@ class DescriptorImpl : public Descriptor
579576 return ret;
580577 }
581578
582- bool ToNormalizedString (const SigningProvider& arg, std::string& out, bool priv ) const override final
579+ bool ToNormalizedString (const SigningProvider& arg, std::string& out) const override final
583580 {
584- bool ret = ToStringHelper (&arg, out, priv , true );
581+ bool ret = ToStringHelper (&arg, out, false , true );
585582 out = AddChecksum (out);
586583 return ret;
587584 }
0 commit comments