wallet::WalletContext

WalletContext struct containing references to state shared between CWallet instances, like the reference to the chain interface, and the list of opened wallets.

Synopsis

Declared in <wallet/context.h>

struct WalletContext;

Description

Future shared state can be added here as an alternative to adding global variables.

The struct isn't intended to have any member functions. It should just be a collection of state pointers that doesn't pull in dependencies or implement behavior.

Member Functions

NameDescription
WalletContext [constructor]Declare default constructor and destructor that are not inline, so code instantiating the WalletContext struct doesn't need to #include class definitions for smart pointer and container members.
~WalletContext [destructor]Destroys the wallet context.

Data Members

NameDescription
args Command-line and configuration arguments.
chain Interface to the blockchain, shared by all wallets.
scheduler Scheduler used to run periodic wallet tasks.
wallet_load_fns Callbacks invoked when a wallet is loaded.
wallets The currently opened wallets.
wallets_mutex Guards the list of opened wallets and load callbacks.

Non-Member Functions

NameDescription
AddWalletRegister a loaded wallet with the wallet context.
CreateWalletCreate a new wallet and load it into the context.
EnsureWalletContextRetrieves the WalletContext stored in an RPC context, throwing if absent.
GetDefaultWalletReturn the default wallet and report how many wallets are loaded.
GetWalletLook up a loaded wallet by name.
GetWalletsReturn all wallets currently loaded in the context.
HandleLoadWalletRegister a callback invoked whenever a wallet is loaded.
LoadWalletLoad an existing wallet from disk into the context.
LoadWalletsLoad wallet databases.
MaybeResendWalletTxsCalled periodically by the schedule thread. Prompts individual wallets to resend their transactions. Actual rebroadcast schedule is managed by the wallets themselves.
NotifyWalletLoadedFire the load-wallet callbacks for a newly loaded wallet.
RemoveWalletRemove a wallet from the wallet context and optionally update its load-on-startup setting.
RemoveWalletRemove a wallet from the wallet context and optionally update its load-on-startup setting.
RestoreWalletRestore a wallet from a backup file.
StartWalletsComplete startup of wallets.
UnloadWalletsStop and unload all wallets held by the context.
VerifyWalletsResponsible for reading and validating the -wallet arguments and verifying the wallet database.