diff options
author | Andrew Chow <achow101-github@achow101.com> | 2019-09-17 19:44:19 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2022-08-03 15:33:15 -0400 |
commit | 272356024db978c92112167f8d8e4cc62adad63d (patch) | |
tree | 13e6d46b171904ea3724d1ec6244e4df615050a6 /src/interfaces | |
parent | 97532867cf51db3e941231fbdc60f9f4fa0012a0 (diff) |
Change getWalletTxs to return a set instead of a vector
For some reason, the primary consumer of getWalletTxs requires the
transactions to be in hash order when it is processing them. std::map
will iterate in hash order so the transactions end up in that order when
placed into the vector. To ensure this order when mapWallet is no longer
ordered, the vector is replaced with a set which will maintain the hash
order.
Diffstat (limited to 'src/interfaces')
-rw-r--r-- | src/interfaces/wallet.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index e29fefae56..4ab416f451 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -183,7 +183,7 @@ public: virtual WalletTx getWalletTx(const uint256& txid) = 0; //! Get list of all wallet transactions. - virtual std::vector<WalletTx> getWalletTxs() = 0; + virtual std::set<WalletTx> getWalletTxs() = 0; //! Try to get updated status for a particular transaction, if possible without blocking. virtual bool tryGetTxStatus(const uint256& txid, @@ -395,6 +395,8 @@ struct WalletTx int64_t time; std::map<std::string, std::string> value_map; bool is_coinbase; + + bool operator<(const WalletTx& a) const { return tx->GetHash() < a.tx->GetHash(); } }; //! Updated transaction status. |