Bitcoin Core 30.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 () const
 
std::optional< CAmountGetEffectiveTotalAmount () const
 
std::optional< CAmountGetAppropriateTotal (bool subtract_fee_outputs) const
 

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
 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 46 of file spend.h.

Member Function Documentation

◆ Add()

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

Definition at line 240 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 203 of file spend.cpp.

Here is the caller graph for this function:

◆ Clear()

void wallet::CoinsResult::Clear ( )

Definition at line 213 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 217 of file spend.cpp.

Here is the caller graph for this function:

◆ GetAppropriateTotal()

std::optional< CAmount > wallet::CoinsResult::GetAppropriateTotal ( bool  subtract_fee_outputs) const
inline

Definition at line 65 of file spend.h.

Here is the caller graph for this function:

◆ GetEffectiveTotalAmount()

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

Definition at line 63 of file spend.h.

Here is the caller graph for this function:

◆ GetTotalAmount()

CAmount wallet::CoinsResult::GetTotalAmount ( ) const
inline

Definition at line 62 of file spend.h.

Here is the caller graph for this function:

◆ Shuffle()

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

Definition at line 233 of file spend.cpp.

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 194 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 56 of file spend.h.

Member Data Documentation

◆ coins

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

Definition at line 47 of file spend.h.

◆ total_amount

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

Sum of all available coins raw value.

Definition at line 71 of file spend.h.

◆ total_effective_amount

std::optional<CAmount> wallet::CoinsResult::total_effective_amount
private

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

Definition at line 73 of file spend.h.


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