Skip to content

Commit

Permalink
trivial: Add missing ComputeHasWitness() function
Browse files Browse the repository at this point in the history
  • Loading branch information
lateminer committed Nov 18, 2024
1 parent b9b4300 commit b5cd9d1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/primitives/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit b5cd9d1

Please sign in to comment.