diff --git a/src/script/descriptor.cpp b/src/script/descriptor.cpp index 076be670ad..273ee448af 100644 --- a/src/script/descriptor.cpp +++ b/src/script/descriptor.cpp @@ -464,13 +464,6 @@ public: } }; -//TODO(stevenroose) remove if unused -CScript P2PKHGetScript(const CPubKey& pubkey) { return GetScriptForDestination(PKHash(pubkey)); } -CScript P2PKGetScript(const CPubKey& pubkey) { return GetScriptForRawPubKey(pubkey); } -CScript P2WPKHGetScript(const CPubKey& pubkey) { return GetScriptForDestination(WitnessV0KeyHash(pubkey.GetID())); } -CScript ConvertP2SH(const CScript& script) { return GetScriptForDestination(ScriptHash(script)); } -CScript ConvertP2WSH(const CScript& script) { return GetScriptForDestination(WitnessV0ScriptHash(script)); } - /** Construct a vector with one element, which is moved into it. */ template std::vector Singleton(T elem) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 790d578fd2..447e17dcb9 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4982,13 +4982,19 @@ UniValue initpegoutwallet(const JSONRPCRequest& request) } FlatSigningProvider provider; - auto desc = Parse(bitcoin_desc, provider); + auto desc = Parse(bitcoin_desc, provider, false); // don't require checksum if (!desc) { throw JSONRPCError(RPC_INVALID_PARAMETER, "bitcoin_descriptor is not a valid descriptor string."); } else if (!desc->IsRange()) { throw JSONRPCError(RPC_INVALID_PARAMETER, "bitcoin_descriptor must be a ranged descriptor."); } + // For our manual pattern matching, we don't want the checksum part. + auto checksum_char = bitcoin_desc.find('#'); + if (checksum_char != std::string::npos) { + bitcoin_desc = bitcoin_desc.substr(0, checksum_char); + } + // Three acceptable descriptors: if (bitcoin_desc.substr(0, 8) == "sh(wpkh(" && bitcoin_desc.substr(bitcoin_desc.size()-2, 2) == "))") { diff --git a/test/functional/feature_pak.py b/test/functional/feature_pak.py index a23e60b9b1..9ae1b7a058 100755 --- a/test/functional/feature_pak.py +++ b/test/functional/feature_pak.py @@ -167,6 +167,8 @@ class PAKTest (BitcoinTestFramework): # Peg out with each new type, check that destination script matches wpkh_desc = "wpkh("+xpub+"/0/*)" + # add a valid checksum + wpkh_desc = self.nodes[1].getdescriptorinfo(wpkh_desc)["descriptor"] wpkh_info = self.nodes[1].initpegoutwallet(wpkh_desc) wpkh_pak_info = self.nodes[1].getwalletpakinfo()