Bitcoin Core 28.99.0
P2P Digital Currency
Public Member Functions | Protected Attributes | List of all members
wallet::ReserveDestination Class Reference

A wrapper to reserve an address from a wallet. More...

#include <wallet.h>

Collaboration diagram for wallet::ReserveDestination:
[legend]

Public Member Functions

 ReserveDestination (CWallet *pwallet, OutputType type)
 Construct a ReserveDestination object. This does NOT reserve an address yet. More...
 
 ReserveDestination (const ReserveDestination &)=delete
 
ReserveDestinationoperator= (const ReserveDestination &)=delete
 
 ~ReserveDestination ()
 Destructor. If a key has been reserved and not KeepKey'ed, it will be returned to the keypool. More...
 
util::Result< CTxDestinationGetReservedDestination (bool internal)
 Reserve an address. More...
 
void ReturnDestination ()
 Return reserved address. More...
 
void KeepDestination ()
 Keep the address. Do not return its key to the keypool when this object goes out of scope. More...
 

Protected Attributes

const CWallet *const pwallet
 The wallet to reserve from. More...
 
ScriptPubKeyManm_spk_man {nullptr}
 The ScriptPubKeyMan to reserve from. Based on type when GetReservedDestination is called. More...
 
OutputType const type
 
int64_t nIndex {-1}
 The index of the address's key in the keypool. More...
 
CTxDestination address
 The destination. More...
 
bool fInternal {false}
 Whether this is from the internal (change output) keypool. More...
 

Detailed Description

A wrapper to reserve an address from a wallet.

ReserveDestination is used to reserve an address. It is currently only used inside of CreateTransaction.

Instantiating a ReserveDestination does not reserve an address. To do so, GetReservedDestination() needs to be called on the object. Once an address has been reserved, call KeepDestination() on the ReserveDestination object to make sure it is not returned. Call ReturnDestination() to return the address so it can be reused (for example, if the address was used in a new transaction and that transaction was not completed and needed to be aborted).

If an address is reserved and KeepDestination() is not called, then the address will be returned when the ReserveDestination goes out of scope.

Definition at line 187 of file wallet.h.

Constructor & Destructor Documentation

◆ ReserveDestination() [1/2]

wallet::ReserveDestination::ReserveDestination ( CWallet pwallet,
OutputType  type 
)
inlineexplicit

Construct a ReserveDestination object. This does NOT reserve an address yet.

Definition at line 204 of file wallet.h.

◆ ReserveDestination() [2/2]

wallet::ReserveDestination::ReserveDestination ( const ReserveDestination )
delete

◆ ~ReserveDestination()

wallet::ReserveDestination::~ReserveDestination ( )
inline

Destructor. If a key has been reserved and not KeepKey'ed, it will be returned to the keypool.

Definition at line 212 of file wallet.h.

Here is the call graph for this function:

Member Function Documentation

◆ operator=()

ReserveDestination & wallet::ReserveDestination::operator= ( const ReserveDestination )
delete

Member Data Documentation

◆ address

CTxDestination wallet::ReserveDestination::address
protected

The destination.

Definition at line 198 of file wallet.h.

◆ fInternal

bool wallet::ReserveDestination::fInternal {false}
protected

Whether this is from the internal (change output) keypool.

Definition at line 200 of file wallet.h.

◆ m_spk_man

ScriptPubKeyMan* wallet::ReserveDestination::m_spk_man {nullptr}
protected

The ScriptPubKeyMan to reserve from. Based on type when GetReservedDestination is called.

Definition at line 193 of file wallet.h.

◆ nIndex

int64_t wallet::ReserveDestination::nIndex {-1}
protected

The index of the address's key in the keypool.

Definition at line 196 of file wallet.h.

◆ pwallet

const CWallet* const wallet::ReserveDestination::pwallet
protected

The wallet to reserve from.

Definition at line 191 of file wallet.h.

◆ type

OutputType const wallet::ReserveDestination::type
protected

Definition at line 194 of file wallet.h.


The documentation for this class was generated from the following files: