Bitcoin Core  27.99.0
P2P Digital Currency
Public Member Functions | Public Attributes | Private Attributes | List of all members
wallet::CoinsResult Struct Reference

COutputs available for spending, stored by OutputType. More...

#include <spend.h>

Public Member Functions

std::vector< COutputAll () const
 Concatenate and return all COutputs as one vector. More...
 
size_t Size () const
 The following methods are provided so that CoinsResult can mimic a vector, i.e., methods can work with individual OutputType vectors or on the entire object. More...
 
size_t TypesCount () const
 Return how many different output types this struct stores. More...
 
void Clear ()
 
void Erase (const std::unordered_set< COutPoint, SaltedOutpointHasher > &coins_to_remove)
 
void Shuffle (FastRandomContext &rng_fast)
 
void Add (OutputType type, const COutput &out)
 
CAmount GetTotalAmount ()
 
std::optional< CAmountGetEffectiveTotalAmount ()
 

Public Attributes

std::map< OutputType, std::vector< COutput > > coins
 

Private Attributes

CAmount total_amount {0}
 Sum of all available coins raw value. More...
 
std::optional< CAmounttotal_effective_amount {0}
 Sum of all available coins effective value (each output value minus fees required to spend it) More...
 

Detailed Description

COutputs available for spending, stored by OutputType.

This struct is really just a wrapper around OutputType vectors with a convenient method for concatenating and returning all COutputs as one vector.

Size(), Clear(), Erase(), Shuffle(), and Add() methods are implemented to allow easy interaction with the struct.

Definition at line 40 of file spend.h.

Member Function Documentation

◆ Add()

void wallet::CoinsResult::Add ( OutputType  type,
const COutput out 
)

Definition at line 229 of file spend.cpp.

Here is the caller graph for this function:

◆ All()

std::vector< COutput > wallet::CoinsResult::All ( ) const

Concatenate and return all COutputs as one vector.

Definition at line 192 of file spend.cpp.

Here is the caller graph for this function:

◆ Clear()

void wallet::CoinsResult::Clear ( )

Definition at line 202 of file spend.cpp.

Here is the caller graph for this function:

◆ Erase()

void wallet::CoinsResult::Erase ( const std::unordered_set< COutPoint, SaltedOutpointHasher > &  coins_to_remove)

Definition at line 206 of file spend.cpp.

Here is the caller graph for this function:

◆ GetEffectiveTotalAmount()

std::optional<CAmount> wallet::CoinsResult::GetEffectiveTotalAmount ( )
inline

Definition at line 57 of file spend.h.

Here is the caller graph for this function:

◆ GetTotalAmount()

CAmount wallet::CoinsResult::GetTotalAmount ( )
inline

Definition at line 56 of file spend.h.

Here is the caller graph for this function:

◆ Shuffle()

void wallet::CoinsResult::Shuffle ( FastRandomContext rng_fast)

Definition at line 222 of file spend.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Size()

size_t wallet::CoinsResult::Size ( ) const

The following methods are provided so that CoinsResult can mimic a vector, i.e., methods can work with individual OutputType vectors or on the entire object.

Definition at line 183 of file spend.cpp.

Here is the caller graph for this function:

◆ TypesCount()

size_t wallet::CoinsResult::TypesCount ( ) const
inline

Return how many different output types this struct stores.

Definition at line 50 of file spend.h.

Member Data Documentation

◆ coins

std::map<OutputType, std::vector<COutput> > wallet::CoinsResult::coins

Definition at line 41 of file spend.h.

◆ total_amount

CAmount wallet::CoinsResult::total_amount {0}
private

Sum of all available coins raw value.

Definition at line 61 of file spend.h.

◆ total_effective_amount

std::optional<CAmount> wallet::CoinsResult::total_effective_amount {0}
private

Sum of all available coins effective value (each output value minus fees required to spend it)

Definition at line 63 of file spend.h.


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