Bitcoin Core
0.18.99
P2P Digital Currency
|
A wrapper to reserve a key from a wallet keypool. More...
#include <wallet.h>
Public Member Functions | |
CReserveKey (CWallet *pwalletIn) | |
Construct a CReserveKey object. This does NOT reserve a key from the keypool yet. More... | |
CReserveKey (const CReserveKey &)=delete | |
CReserveKey & | operator= (const CReserveKey &)=delete |
~CReserveKey () | |
Destructor. If a key has been reserved and not KeepKey'ed, it will be returned to the keypool. More... | |
bool | GetReservedKey (CPubKey &pubkey, bool internal=false) |
Reserve a key from the keypool. More... | |
void | ReturnKey () |
Return a key to the keypool. More... | |
void | KeepKey () |
Keep the key. Do not return it to the keypool when this object goes out of scope. More... | |
Protected Attributes | |
CWallet * | pwallet |
The wallet to reserve the keypool key from. More... | |
int64_t | nIndex {-1} |
The index of the key in the keypool. More... | |
CPubKey | vchPubKey |
The public key. More... | |
bool | fInternal {false} |
Whether this is from the internal (change output) keypool. More... | |
A wrapper to reserve a key from a wallet keypool.
CReserveKey is used to reserve a key from the keypool. It is passed around during the CreateTransaction/CommitTransaction procedure.
Instantiating a CReserveKey does not reserve a keypool key. To do so, GetReservedKey() needs to be called on the object. Once a key has been reserved, call KeepKey() on the CReserveKey object to make sure it is not returned to the keypool. Call ReturnKey() to return the key to the keypool so it can be re-used (for example, if the key was used in a new transaction and that transaction was not completed and needed to be aborted).
If a key is reserved and KeepKey() is not called, then the key will be returned to the keypool when the CReserveObject goes out of scope.
|
inlineexplicit |
Construct a CReserveKey object. This does NOT reserve a key from the keypool yet.
|
delete |
|
inline |
|
delete |
|
protected |
|
protected |
|
protected |