aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-10-27 12:38:21 +0200
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-10-27 13:01:42 +0200
commitfaec889f938f90e0b887426db27a15ec0d169399 (patch)
treebd32913df89db000f46022e311540dffbdbea257 /src/util
parente789b30b2565c8bdbf48a45f2c5a7b92e5d61d25 (diff)
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/util')
-rw-r--r--src/util/transaction_identifier.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/util/transaction_identifier.h b/src/util/transaction_identifier.h
index 77f4b8367d..4fb9b49966 100644
--- a/src/util/transaction_identifier.h
+++ b/src/util/transaction_identifier.h
@@ -1,6 +1,7 @@
#ifndef BITCOIN_UTIL_TRANSACTION_IDENTIFIER_H
#define BITCOIN_UTIL_TRANSACTION_IDENTIFIER_H
+#include <attributes.h>
#include <uint256.h>
#include <util/types.h>
@@ -35,7 +36,7 @@ public:
template <typename Other>
bool operator<(const Other& other) const { return Compare(other) < 0; }
- uint256 ToUint256() const { return m_wrapped; }
+ const uint256& ToUint256() const LIFETIMEBOUND { return m_wrapped; }
static transaction_identifier FromUint256(const uint256& id) { return {id}; }
/** Wrapped `uint256` methods. */
@@ -56,7 +57,7 @@ public:
* TODO: This should be removed once the majority of the code has switched
* to using the Txid and Wtxid types. Until then it makes for a smoother
* transition to allow this conversion. */
- operator uint256() const { return m_wrapped; }
+ operator const uint256&() const LIFETIMEBOUND { return m_wrapped; }
};
/** Txid commits to all transaction fields except the witness. */