A ScriptPubKeyMan backed by a single output descriptor.

Synopsis

Declared in <wallet/scriptpubkeyman.h>

class DescriptorScriptPubKeyMan
    : public ScriptPubKeyMan

Base Classes

Name

Description

ScriptPubKeyMan

A class implementing ScriptPubKeyMan manages some (or all) scriptPubKeys used in a wallet. It contains the scripts and keys related to the scriptPubKeys it manages. A ScriptPubKeyMan will be able to give out scriptPubKeys to be used, as well as marking when a scriptPubKey has been used. It also handles when and how to store a scriptPubKey and its related scripts and keys, including encryption.

Member Functions

Name

Description

CanGetAddresses [virtual]

Returns whether this spkm can hand out new addresses.

CanProvide [virtual]

Returns whether this spkm can contribute solving data for the given script.

CanUpdateToWalletDescriptor

Returns whether this spkm can be updated to the given descriptor.

CheckDecryptionKey [virtual]

Checks whether the given master key decrypts this spkm's keys.

Encrypt [virtual]

Encrypts this spkm's keys with the given master key.

FillPSBT [virtual]

Adds descriptor and derivation information to a PSBT and optionally signs it.

GetDescriptorString

Serializes the descriptor to a string, optionally including private keys.

GetEndRange

Returns the end of the descriptor's derivation range.

GetID [virtual]

Returns a stable identifier for this spkm derived from its descriptor.

GetKey

Retrieve the particular key if it is available. Returns nullopt if the key is not in the wallet, or if the wallet is locked.

GetKeyPoolSize [virtual]

Returns the number of pre‐generated keys/scripts in the cache.

GetMetadata [virtual]

Returns the key metadata for the given destination, or nullptr if none is known.

GetNewDestination

GetNewDestination overloads

GetReservedDestination

GetReservedDestination overloads

GetScriptPubKeys

GetScriptPubKeys overloads

GetSigningProvider

Fetch the SigningProvider for the given pubkey and always include private keys. This should only be called by signing code.

GetSolvingProvider [virtual]

Returns a SigningProvider able to solve the given script.

GetTimeFirstKey [virtual]

Returns the creation time of the descriptor, used as the wallet's birth time.

GetWalletDescriptor

Returns a copy of this spkm's wallet descriptor.

HasPrivKey

Returns whether the private key for the given key id is present.

HasWalletDescriptor

Returns whether this spkm holds the given wallet descriptor.

HaveCryptedKeys [virtual]

Returns whether this spkm holds any encrypted private keys.

HavePrivateKeys [virtual]

Returns whether this spkm holds any unencrypted private keys.

IsHDEnabled [virtual]

Returns whether this descriptor uses HD derivation.

IsMine [virtual]

Returns whether the given script is derived from this descriptor.

KeepDestination [virtual]

Marks a previously reserved destination as used so it is not handed out again.

MarkUnusedAddresses [virtual]

Marks addresses up to and including the one for the given script as used.

ReturnDestination [virtual]

Returns a previously reserved destination to the cache for reuse.

SignMessage [virtual]

Signs a message with the key for the given script.

SignTransaction [virtual]

Creates signatures for this spkm's inputs and adds them to the transaction.

TopUp [virtual]

Tops up the descriptor cache and m_map_script_pub_keys. The cache is stored in the wallet file and is used to expand the descriptor in GetNewDestination. Descriptor wallets rely more on ephemeral data than legacy wallets. For wallets using unhardened derivation (with or without private keys), the "keypool" is a single xpub.

UpdateWalletDescriptor

Updates this spkm's descriptor, e.g. to add private keys or cache data.

UpgradeDescriptorCache

Upgrades the on‐disk descriptor cache to the current format.

WalletLogPrintf

Prepends the wallet name in logging output to ease debugging in multi‐wallet use cases

WriteDescriptor

Writes this spkm's descriptor to the wallet database.

Static Member Functions

Name

Description

CreateFromImport

Creates a DescriptorScriptPubKeyMan from an imported descriptor and signing provider.

CreateFromMigration

Creates a DescriptorScriptPubKeyMan while migrating a legacy wallet.

GenerateNewSingleSig

Generates a new single‐signature DescriptorScriptPubKeyMan from a master key.

LoadFromStorage

Loads a DescriptorScriptPubKeyMan from stored wallet data.

Data Members

Name

Description

NotifyCanGetAddressesChanged

Keypool has new keys

NotifyFirstKeyTimeChanged

Birth time changed

cs_desc_man

Guards this spkm's descriptor, key, and cache state.

Protected Member Functions

Name

Description

DescriptorScriptPubKeyMan [constructor]

Constructors

DecIndex

Rewinds the descriptor's next‐index counter by one.

IncIndex

Advances the descriptor's next‐index counter by one.

SetRangeEnd

Sets the end of the descriptor's derivation range.

TopUpWithDB

Same as 'TopUp' but designed for use within a batch transaction context

Protected Data Members

Name

Description

m_storage

The wallet storage this ScriptPubKeyMan uses to persist and query wallet‐wide state.

m_wallet_descriptor

The wallet descriptor backing this spkm.

Created with MrDocs