mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-12 05:34:57 +01:00
Add unmodified-but-with-checksum to getdescriptorinfo
This commit is contained in:
@@ -938,6 +938,14 @@ std::unique_ptr<Descriptor> Parse(const std::string& descriptor, FlatSigningProv
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string GetDescriptorChecksum(const std::string& descriptor)
|
||||
{
|
||||
std::string ret;
|
||||
Span<const char> sp(descriptor.data(), descriptor.size());
|
||||
if (!CheckChecksum(sp, false, &ret)) return "";
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::unique_ptr<Descriptor> InferDescriptor(const CScript& script, const SigningProvider& provider)
|
||||
{
|
||||
return InferScript(script, ParseScriptContext::TOP, provider);
|
||||
|
||||
@@ -81,6 +81,14 @@ struct Descriptor {
|
||||
*/
|
||||
std::unique_ptr<Descriptor> Parse(const std::string& descriptor, FlatSigningProvider& out, bool require_checksum = false);
|
||||
|
||||
/** Get the checksum for a descriptor.
|
||||
*
|
||||
* If it already has one, and it is correct, return the checksum in the input.
|
||||
* If it already has one that is wrong, return "".
|
||||
* If it does not already have one, return the checksum that would need to be added.
|
||||
*/
|
||||
std::string GetDescriptorChecksum(const std::string& descriptor);
|
||||
|
||||
/** Find a descriptor for the specified script, using information from provider where possible.
|
||||
*
|
||||
* A non-ranged descriptor which only generates the specified script will be returned in all
|
||||
|
||||
Reference in New Issue
Block a user