diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-10-27 12:38:21 +0200 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-10-27 13:01:42 +0200 |
commit | faec889f938f90e0b887426db27a15ec0d169399 (patch) | |
tree | bd32913df89db000f46022e311540dffbdbea257 /src/primitives | |
parent | e789b30b2565c8bdbf48a45f2c5a7b92e5d61d25 (diff) | |
download | bitcoin-faec889f938f90e0b887426db27a15ec0d169399.tar.xz |
refactor: Add LIFETIMEBOUND to all (w)txid getters
Then, use the compiler warnings to create copies only where needed.
Also, fix iwyu includes while touching the includes.
Diffstat (limited to 'src/primitives')
-rw-r--r-- | src/primitives/transaction.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 2516647a84..89deb9de4d 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -6,8 +6,8 @@ #ifndef BITCOIN_PRIMITIVES_TRANSACTION_H #define BITCOIN_PRIMITIVES_TRANSACTION_H +#include <attributes.h> #include <consensus/amount.h> -#include <prevector.h> #include <script/script.h> #include <serialize.h> #include <uint256.h> @@ -335,8 +335,8 @@ public: return vin.empty() && vout.empty(); } - const Txid& GetHash() const { return hash; } - const Wtxid& GetWitnessHash() const { return m_witness_hash; }; + const Txid& GetHash() const LIFETIMEBOUND { return hash; } + const Wtxid& GetWitnessHash() const LIFETIMEBOUND { return m_witness_hash; }; // Return sum of txouts. CAmount GetValueOut() const; @@ -433,7 +433,7 @@ public: static GenTxid Txid(const uint256& hash) { return GenTxid{false, hash}; } static GenTxid Wtxid(const uint256& hash) { return GenTxid{true, hash}; } bool IsWtxid() const { return m_is_wtxid; } - const uint256& GetHash() const { return m_hash; } + const uint256& GetHash() const LIFETIMEBOUND { return m_hash; } friend bool operator==(const GenTxid& a, const GenTxid& b) { return a.m_is_wtxid == b.m_is_wtxid && a.m_hash == b.m_hash; } friend bool operator<(const GenTxid& a, const GenTxid& b) { return std::tie(a.m_is_wtxid, a.m_hash) < std::tie(b.m_is_wtxid, b.m_hash); } }; |