[#wallet-ReserveDestination]
= xref:wallet.adoc[wallet]::ReserveDestination
:relfileprefix: ../
:mrdocs:

A wrapper to reserve an address from a wallet

== Synopsis

Declared in `&lt;wallet&sol;wallet&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class ReserveDestination;
----

== Description

ReserveDestination is used to reserve an address&period; It is currently only used inside of CreateTransaction&period;

Instantiating a ReserveDestination does not reserve an address&period; To do so, GetReservedDestination() needs to be called on the object&period; Once an address has been reserved, call KeepDestination() on the ReserveDestination object to make sure it is not returned&period; 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)&period;

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

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:wallet/ReserveDestination/2constructor-07.adoc[`ReserveDestination`]         [.small]#[constructor]#
| Constructors
| xref:wallet/ReserveDestination/2destructor.adoc[`&#126;ReserveDestination`] [.small]#[destructor]#
| Destructor&period; If a key has been reserved and not KeepKey&apos;ed, it will be returned to the keypool
| xref:wallet/ReserveDestination/operator_assign.adoc[`operator&equals;`]  [.small]#[deleted]#
| Deleted copy assignment&semi; a reservation must not be copied&period;
| xref:wallet/ReserveDestination/GetReservedDestination.adoc[`GetReservedDestination`] 
| Reserve an address
| xref:wallet/ReserveDestination/KeepDestination.adoc[`KeepDestination`] 
| Keep the address&period; Do not return its key to the keypool when this object goes out of scope
| xref:wallet/ReserveDestination/ReturnDestination.adoc[`ReturnDestination`] 
| Return reserved address
|===


== Protected Data Members

[cols="1,4"]
|===
| Name| Description
| xref:wallet/ReserveDestination/address.adoc[`address`] 
| The destination
| xref:wallet/ReserveDestination/fInternal.adoc[`fInternal`] 
| Whether this is from the internal (change output) keypool
| xref:wallet/ReserveDestination/m_spk_man.adoc[`m&lowbar;spk&lowbar;man`] 
| The ScriptPubKeyMan to reserve from&period; Based on type when GetReservedDestination is called
| xref:wallet/ReserveDestination/nIndex.adoc[`nIndex`] 
| The index of the address&apos;s key in the keypool
| xref:wallet/ReserveDestination/pwallet.adoc[`pwallet`] 
| The wallet to reserve from
| xref:wallet/ReserveDestination/type.adoc[`type`] 
| The output type of the address to reserve
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
