Bitcoin
Public Member Functions | Protected Attributes | List of all members
ReserveDestination Class Reference

#include <wallet.h>

Public Member Functions

 ReserveDestination (CWallet *pwalletIn)
 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...
 
bool GetReservedDestination (const OutputType type, CTxDestination &pubkey, bool internal)
 Reserve an address. More...
 
void ReturnDestination ()
 Return reserved address. More...
 
void KeepDestination ()
 Keep the address. Do not return it's key to the keypool when this object goes out of scope. More...
 

Protected Attributes

CWalletpwallet
 The wallet to reserve from. More...
 
int64_t nIndex {-1}
 The index of the address's key in the keypool. More...
 
CPubKey vchPubKey
 The public key for the address. 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 passed around during the CreateTransaction/CommitTransaction procedure.

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 re-used (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.

Constructor & Destructor Documentation

◆ ReserveDestination() [1/2]

ReserveDestination::ReserveDestination ( CWallet pwalletIn)
inlineexplicit

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

◆ ReserveDestination() [2/2]

ReserveDestination::ReserveDestination ( const ReserveDestination )
delete

◆ ~ReserveDestination()

ReserveDestination::~ReserveDestination ( )
inline

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

Member Function Documentation

◆ operator=()

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

Member Data Documentation

◆ address

CTxDestination ReserveDestination::address
protected

The destination.

◆ fInternal

bool ReserveDestination::fInternal {false}
protected

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

◆ nIndex

int64_t ReserveDestination::nIndex {-1}
protected

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

◆ pwallet

CWallet* ReserveDestination::pwallet
protected

The wallet to reserve from.

◆ vchPubKey

CPubKey ReserveDestination::vchPubKey
protected

The public key for the address.


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