aboutsummaryrefslogtreecommitdiff
path: root/src/primitives/transaction.h
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-10-29 10:05:13 +0100
committerfanquake <fanquake@gmail.com>2023-10-29 10:10:53 +0100
commit42b0d5f59b868e8ed5ae6c7df3bc133f79e3bfb3 (patch)
treebd32913df89db000f46022e311540dffbdbea257 /src/primitives/transaction.h
parente789b30b2565c8bdbf48a45f2c5a7b92e5d61d25 (diff)
parentfaec889f938f90e0b887426db27a15ec0d169399 (diff)
downloadbitcoin-42b0d5f59b868e8ed5ae6c7df3bc133f79e3bfb3.tar.xz
Merge bitcoin/bitcoin#28740: refactor: Add LIFETIMEBOUND to all (w)txid getters
faec889f938f90e0b887426db27a15ec0d169399 refactor: Add LIFETIMEBOUND to all (w)txid getters (MarcoFalke) Pull request description: Currently some getters return a reference, some don't. Fix this by returning a reference everywhere. Also, add `LIFETIMEBOUND` to all. Then, use the compiler warnings to create copies only where needed. Also, fix iwyu includes while touching the includes. ACKs for top commit: dergoegge: Code review ACK faec889f938f90e0b887426db27a15ec0d169399 stickies-v: ACK faec889f938f90e0b887426db27a15ec0d169399 pablomartin4btc: cr ACK faec889f938f90e0b887426db27a15ec0d169399 Tree-SHA512: 0c2a151f39d0e007b4d33b0b85ad578cc220f3e9dd94890e812b3181c3901545b039325707731cc39a5e89557f59c1154c6320525f78f5de95f119a514d2d23f
Diffstat (limited to 'src/primitives/transaction.h')
-rw-r--r--src/primitives/transaction.h8
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); }
};