Bitcoin Forum
May 26, 2024, 11:01:52 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Computing transaction hash  (Read 168 times)
Frodek (OP)
Member
**
Offline Offline

Activity: 138
Merit: 25


View Profile
March 11, 2019, 10:17:13 AM
 #1

Where in code is computing transaction hash?
CTransaction::ComputeHash()?
Heisenberg_Hunter
Legendary
*
Offline Offline

Activity: 1583
Merit: 1278


Heisenberg Design Services


View Profile WWW
March 11, 2019, 11:41:46 AM
 #2

If you had done a general search in the code base you could have got them,

The CTransaction::ComputeHash() is present in bitcoin/src/primitives/transaction.cpp #L65

Code:
uint256 CTransaction::ComputeHash() const
{
    return SerializeHash(*this, SER_GETHASH, SERIALIZE_TRANSACTION_NO_WITNESS);
}

uint256 CTransaction::ComputeWitnessHash() const
{
    if (!HasWitness()) {
        return hash;
    }
    return SerializeHash(*this, SER_GETHASH, 0);
}

BTW what are you trying to achieve with this?  Huh
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!