aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2018-07-27 12:21:12 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2018-07-27 12:21:12 -0700
commitf6b7fc349ccf9cfbeb7e91e19c20e2a2fcc9026f (patch)
tree4f5e3cb6933ef7399fb69d47b935b3ab24467c23 /src/test
parentfddea672eb8f63012f2e9ce04fa477e5d4140750 (diff)
downloadbitcoin-f6b7fc349ccf9cfbeb7e91e19c20e2a2fcc9026f.tar.xz
Support h instead of ' in hardened descriptor paths
Diffstat (limited to 'src/test')
-rw-r--r--src/test/descriptor_tests.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/test/descriptor_tests.cpp b/src/test/descriptor_tests.cpp
index 6d0492e050..f189222be8 100644
--- a/src/test/descriptor_tests.cpp
+++ b/src/test/descriptor_tests.cpp
@@ -28,13 +28,28 @@ constexpr int HARDENED = 2; // Derivation needs access to private keys
constexpr int UNSOLVABLE = 4; // This descriptor is not expected to be solvable
constexpr int SIGNABLE = 8; // We can sign with this descriptor (this is not true when actual BIP32 derivation is used, as that's not integrated in our signing code)
+std::string MaybeUseHInsteadOfApostrophy(std::string ret)
+{
+ if (InsecureRandBool()) {
+ while (true) {
+ auto it = ret.find("'");
+ if (it != std::string::npos) {
+ ret[it] = 'h';
+ } else {
+ break;
+ }
+ }
+ }
+ return ret;
+}
+
void Check(const std::string& prv, const std::string& pub, int flags, const std::vector<std::vector<std::string>>& scripts)
{
FlatSigningProvider keys_priv, keys_pub;
// Check that parsing succeeds.
- auto parse_priv = Parse(prv, keys_priv);
- auto parse_pub = Parse(pub, keys_pub);
+ auto parse_priv = Parse(MaybeUseHInsteadOfApostrophy(prv), keys_priv);
+ auto parse_pub = Parse(MaybeUseHInsteadOfApostrophy(pub), keys_pub);
BOOST_CHECK(parse_priv);
BOOST_CHECK(parse_pub);