28 return it !=
m_selected.end() && it->second.HasTxOut();
34 if (it ==
m_selected.end() || !it->second.HasTxOut()) {
37 return it->second.GetTxOut();
59 std::vector<COutPoint> outpoints;
61 [](
const std::map<COutPoint, PreselectedInput>::value_type& pair) {
75 return it !=
m_selected.end() ? it->second.GetInputWeight() : std::nullopt;
81 return it !=
m_selected.end() ? it->second.GetSequence() : std::nullopt;
87 return it !=
m_selected.end() ?
m_selected.at(outpoint).GetScripts() : std::make_pair(std::nullopt, std::nullopt);
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
An outpoint - a combination of a transaction hash and an index n into its vout.
Serialized script, used inside transaction inputs and outputs.
An output of a transaction.
bool IsSelected(const COutPoint &outpoint) const
Returns true if the given output is pre-selected.
std::optional< CTxOut > GetExternalOutput(const COutPoint &outpoint) const
Returns the external output for the given outpoint if it exists.
std::map< COutPoint, PreselectedInput > m_selected
Selected inputs (inputs that will be used, regardless of whether they're optimal or not)
std::optional< int64_t > GetInputWeight(const COutPoint &outpoint) const
Returns the input weight.
void UnSelectAll()
Unselects all outputs.
void UnSelect(const COutPoint &outpoint)
Unselects the given output.
PreselectedInput & Select(const COutPoint &outpoint)
Lock-in the given output for spending.
bool HasSelected() const
Returns true if there are pre-selected inputs.
bool IsExternalSelected(const COutPoint &outpoint) const
Returns true if the given output is selected as an external input.
std::pair< std::optional< CScript >, std::optional< CScriptWitness > > GetScripts(const COutPoint &outpoint) const
Retrieves the scriptSig and scriptWitness for an input.
void SetInputWeight(const COutPoint &outpoint, int64_t weight)
Set an input's weight.
bool m_avoid_partial_spends
Avoid partial use of funds sent to a given address.
unsigned int m_selection_pos
std::vector< COutPoint > ListSelected() const
List the selected inputs.
std::optional< uint32_t > GetSequence(const COutPoint &outpoint) const
Retrieve the sequence for an input.
static constexpr bool DEFAULT_AVOIDPARTIALSPENDS
Default for -avoidpartialspends.