InferDescriptor

Find a descriptor for the specified script, using information from provider where possible.

Synopsis

Declared in <script/descriptor.h>

std::unique_ptr<Descriptor>
InferDescriptor(
    CScript const& script,
    SigningProvider const& provider);

Description

A non-ranged descriptor which only generates the specified script will be returned in all circumstances.

For public keys with key origin information, this information will be preserved in the returned descriptor.

  • If all information for solving script is present in provider, a descriptor will be returned which is IsSolvable() and encapsulates said information.

  • Failing that, if script corresponds to a known address type, an "addr()" descriptor will be returned (which is not IsSolvable()).

  • Failing that, a "raw()" descriptor is returned.

Return Value

The inferred descriptor for the script.

Parameters

NameDescription
script [in]The script to infer a descriptor for.
provider [in]Source of extra key and script information used during inference.