@@ -181,7 +181,7 @@ struct PubkeyProvider
181
181
virtual bool ToPrivateString (const SigningProvider& arg, std::string& out) const = 0;
182
182
183
183
/* * 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;
185
185
186
186
/* * Derive a private key, if private data is available in arg. */
187
187
virtual bool GetPrivKey (int pos, const SigningProvider& arg, CKey& key) const = 0;
@@ -216,10 +216,10 @@ class OriginPubkeyProvider final : public PubkeyProvider
216
216
ret = " [" + OriginString () + " ]" + std::move (sub);
217
217
return true ;
218
218
}
219
- bool ToNormalizedString (const SigningProvider& arg, std::string& ret, bool priv ) const override
219
+ bool ToNormalizedString (const SigningProvider& arg, std::string& ret) const override
220
220
{
221
221
std::string sub;
222
- if (!m_provider->ToNormalizedString (arg, sub, priv )) return false ;
222
+ if (!m_provider->ToNormalizedString (arg, sub)) return false ;
223
223
// If m_provider is a BIP32PubkeyProvider, we may get a string formatted like a OriginPubkeyProvider
224
224
// In that case, we need to strip out the leading square bracket and fingerprint from the substring,
225
225
// and append that to our own origin string.
@@ -263,9 +263,8 @@ class ConstPubkeyProvider final : public PubkeyProvider
263
263
ret = EncodeSecret (key);
264
264
return true ;
265
265
}
266
- bool ToNormalizedString (const SigningProvider& arg, std::string& ret, bool priv ) const override
266
+ bool ToNormalizedString (const SigningProvider& arg, std::string& ret) const override
267
267
{
268
- if (priv) return ToPrivateString (arg, ret);
269
268
ret = ToString ();
270
269
return true ;
271
270
}
@@ -413,11 +412,10 @@ class BIP32PubkeyProvider final : public PubkeyProvider
413
412
}
414
413
return true ;
415
414
}
416
- bool ToNormalizedString (const SigningProvider& arg, std::string& out, bool priv ) const override
415
+ bool ToNormalizedString (const SigningProvider& arg, std::string& out) const override
417
416
{
418
417
// For hardened derivation type, just return the typical string, nothing to normalize
419
418
if (m_derive == DeriveType::HARDENED) {
420
- if (priv) return ToPrivateString (arg, out);
421
419
out = ToString ();
422
420
return true ;
423
421
}
@@ -430,7 +428,6 @@ class BIP32PubkeyProvider final : public PubkeyProvider
430
428
}
431
429
// Either no derivation or all unhardened derivation
432
430
if (i == -1 ) {
433
- if (priv) return ToPrivateString (arg, out);
434
431
out = ToString ();
435
432
return true ;
436
433
}
@@ -456,7 +453,7 @@ class BIP32PubkeyProvider final : public PubkeyProvider
456
453
}
457
454
// Build the string
458
455
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);
460
457
if (IsRange ()) {
461
458
out += " /*" ;
462
459
assert (m_derive == DeriveType::UNHARDENED);
@@ -550,7 +547,7 @@ class DescriptorImpl : public Descriptor
550
547
if (pos++) ret += " ," ;
551
548
std::string tmp;
552
549
if (normalized) {
553
- if (!pubkey->ToNormalizedString (*arg, tmp, priv )) return false ;
550
+ if (!pubkey->ToNormalizedString (*arg, tmp)) return false ;
554
551
} else if (priv) {
555
552
if (!pubkey->ToPrivateString (*arg, tmp)) return false ;
556
553
} else {
@@ -579,9 +576,9 @@ class DescriptorImpl : public Descriptor
579
576
return ret;
580
577
}
581
578
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
583
580
{
584
- bool ret = ToStringHelper (&arg, out, priv , true );
581
+ bool ret = ToStringHelper (&arg, out, false , true );
585
582
out = AddChecksum (out);
586
583
return ret;
587
584
}
0 commit comments