diff options
author | Aurèle Oulès <aurele@oules.com> | 2022-09-12 12:03:07 +0200 |
---|---|---|
committer | Aurèle Oulès <aurele@oules.com> | 2023-04-26 10:16:16 +0200 |
commit | 1db23da6e163e793458ec702a9601d2837aea9cb (patch) | |
tree | 46c8131d1899455f73f2bd33acd29e546d49c14c /src/wallet/coincontrol.h | |
parent | becc45b589d07c4523276e4ba2dad8852d0d2632 (diff) | |
download | bitcoin-1db23da6e163e793458ec702a9601d2837aea9cb.tar.xz |
wallet: Use std::optional for GetExternalOutput and fixups
Diffstat (limited to 'src/wallet/coincontrol.h')
-rw-r--r-- | src/wallet/coincontrol.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/wallet/coincontrol.h b/src/wallet/coincontrol.h index 86069d005e..04f524028f 100644 --- a/src/wallet/coincontrol.h +++ b/src/wallet/coincontrol.h @@ -13,9 +13,9 @@ #include <script/signingprovider.h> #include <script/standard.h> -#include <optional> #include <algorithm> #include <map> +#include <optional> #include <set> namespace wallet { @@ -65,27 +65,27 @@ public: bool HasSelected() const { - return (m_selected_inputs.size() > 0); + return !m_selected_inputs.empty(); } bool IsSelected(const COutPoint& output) const { - return (m_selected_inputs.count(output) > 0); + return m_selected_inputs.count(output) > 0; } bool IsExternalSelected(const COutPoint& output) const { - return (m_external_txouts.count(output) > 0); + return m_external_txouts.count(output) > 0; } - bool GetExternalOutput(const COutPoint& outpoint, CTxOut& txout) const + std::optional<CTxOut> GetExternalOutput(const COutPoint& outpoint) const { const auto ext_it = m_external_txouts.find(outpoint); if (ext_it == m_external_txouts.end()) { - return false; + return std::nullopt; } - txout = ext_it->second; - return true; + + return std::make_optional(ext_it->second); } void Select(const COutPoint& output) |