Add normalized transaction hash
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "hash.h"
|
||||
#include "tinyformat.h"
|
||||
#include "utilstrencodings.h"
|
||||
#include "script/interpreter.h"
|
||||
|
||||
std::string COutPoint::ToString() const
|
||||
{
|
||||
@@ -68,6 +69,11 @@ uint256 CMutableTransaction::GetHash() const
|
||||
return SerializeHash(*this);
|
||||
}
|
||||
|
||||
uint256 CMutableTransaction::GetNormalizedHash() const
|
||||
{
|
||||
return SignatureHash(CScript(), *this, 0, SIGHASH_ALL);
|
||||
}
|
||||
|
||||
void CTransaction::UpdateHash() const
|
||||
{
|
||||
*const_cast<uint256*>(&hash) = SerializeHash(*this);
|
||||
|
||||
@@ -338,6 +338,8 @@ struct CMutableTransaction
|
||||
* fly, as opposed to GetHash() in CTransaction, which uses a cached result.
|
||||
*/
|
||||
uint256 GetHash() const;
|
||||
|
||||
uint256 GetNormalizedHash() const;
|
||||
};
|
||||
|
||||
#endif // BITCOIN_PRIMITIVES_TRANSACTION_H
|
||||
|
||||
Reference in New Issue
Block a user