wallet::ReserveDestination

A wrapper to reserve an address from a wallet

Synopsis

Declared in <wallet/wallet.h>

class ReserveDestination;

Description

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.

Member Functions

NameDescription
ReserveDestination [constructor]Constructors
~ReserveDestination [destructor]Destructor. If a key has been reserved and not KeepKey'ed, it will be returned to the keypool
operator= [deleted]Deleted copy assignment; a reservation must not be copied.
GetReservedDestination Reserve an address
KeepDestination Keep the address. Do not return its key to the keypool when this object goes out of scope
ReturnDestination Return reserved address

Protected Data Members

NameDescription
address The destination
fInternal Whether this is from the internal (change output) keypool
m_spk_man The ScriptPubKeyMan to reserve from. Based on type when GetReservedDestination is called
nIndex The index of the address's key in the keypool
pwallet The wallet to reserve from
type The output type of the address to reserve