diff options
author | dergoegge <n.goeggi@gmail.com> | 2023-11-01 14:04:44 +0000 |
---|---|---|
committer | dergoegge <n.goeggi@gmail.com> | 2023-11-01 15:15:05 +0000 |
commit | af1d2ff88344e1545ac8d9ad09f8e37e264da712 (patch) | |
tree | 1e042949d8dcd863849a5b5432ddc434c42e39e4 /src/primitives/transaction.h | |
parent | d51fb9caa622add96c6b594e162da5584eb927fc (diff) |
[primitives] Precompute result of CTransaction::HasWitness
Diffstat (limited to 'src/primitives/transaction.h')
-rw-r--r-- | src/primitives/transaction.h | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 89deb9de4d..594168bbcc 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -310,12 +310,15 @@ public: private: /** Memory only. */ + const bool m_has_witness; const Txid hash; const Wtxid m_witness_hash; Txid ComputeHash() const; Wtxid ComputeWitnessHash() const; + bool ComputeHasWitness() const; + public: /** Convert a CMutableTransaction into a CTransaction. */ explicit CTransaction(const CMutableTransaction& tx); @@ -365,15 +368,7 @@ public: std::string ToString() const; - bool HasWitness() const - { - for (size_t i = 0; i < vin.size(); i++) { - if (!vin[i].scriptWitness.IsNull()) { - return true; - } - } - return false; - } + bool HasWitness() const { return m_has_witness; } }; /** A mutable version of CTransaction. */ |