aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/spend.h
diff options
context:
space:
mode:
authorjosibake <josibake@protonmail.com>2022-07-29 10:35:50 +0200
committerjosibake <josibake@protonmail.com>2022-08-10 15:19:31 +0200
commitdb09aec9378c5e8cc49c866fa50bfcb6c567d66c (patch)
tree5cf4f9e2cb7768414f6190553bdb2e2dbd809458 /src/wallet/spend.h
parentb6b50b0f2b055d81c5d4ff9e21dd88cdc9a88ccb (diff)
downloadbitcoin-db09aec9378c5e8cc49c866fa50bfcb6c567d66c.tar.xz
wallet: switch to new shuffle, erase, push_back
switch to new methods, remove old code. this also updates the Size, All, and Clear methods to now use the coins map. this commit is not strictly a refactor because previously coin selection was never run over the UNKNOWN type until the last step when being run over all. now that we are iterating over each, it is run over UNKNOWN but this is expected to be empty most of the time. Co-authored-by: furszy <matiasfurszyfer@protonmail.com>
Diffstat (limited to 'src/wallet/spend.h')
-rw-r--r--src/wallet/spend.h14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/wallet/spend.h b/src/wallet/spend.h
index e11a126cda..c29e5be5c7 100644
--- a/src/wallet/spend.h
+++ b/src/wallet/spend.h
@@ -34,26 +34,18 @@ TxSize CalculateMaximumSignedTxSize(const CTransaction& tx, const CWallet* walle
* This struct is really just a wrapper around OutputType vectors with a convenient
* method for concatenating and returning all COutputs as one vector.
*
- * Clear(), Size() methods are implemented so that one can interact with
- * the CoinsResult struct as if it was a vector
+ * Size(), Clear(), Erase(), Shuffle(), and Add() methods are implemented to
+ * allow easy interaction with the struct.
*/
struct CoinsResult {
std::map<OutputType, std::vector<COutput>> coins;
- /** Vectors for each OutputType */
- std::vector<COutput> legacy;
- std::vector<COutput> P2SH_segwit;
- std::vector<COutput> bech32;
- std::vector<COutput> bech32m;
-
- /** Other is a catch-all for anything that doesn't match the known OutputTypes */
- std::vector<COutput> other;
/** Concatenate and return all COutputs as one vector */
std::vector<COutput> All() 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 */
- uint64_t Size() const;
+ size_t Size() const;
void Clear();
void Erase(std::set<COutPoint>& preset_coins);
void Shuffle(FastRandomContext& rng_fast);