mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 09:43:55 +02:00
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.
This commit is contained in:
@@ -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); }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user