From b5cd9d1e7740e45dd4d3287764452d111d6c499e Mon Sep 17 00:00:00 2001 From: lateminer <9951982+lateminer@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:49:37 +0100 Subject: [PATCH] trivial: Add missing ComputeHasWitness() function --- src/primitives/transaction.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp index ec9ce51508..93430c6998 100644 --- a/src/primitives/transaction.cpp +++ b/src/primitives/transaction.cpp @@ -73,6 +73,13 @@ Txid CMutableTransaction::GetHash() const return Txid::FromUint256((HashWriter{} << TX_NO_WITNESS(*this)).GetHash()); } +bool CTransaction::ComputeHasWitness() const +{ + return std::any_of(vin.begin(), vin.end(), [](const auto& input) { + return !input.scriptWitness.IsNull(); + }); +} + Txid CTransaction::ComputeHash() const { return Txid::FromUint256((HashWriter{} << TX_NO_WITNESS(*this)).GetHash());