make transactions calculate their hash on parse

This commit is contained in:
Manuel Araoz 2014-01-10 14:12:23 -03:00
parent 2513a08eb9
commit 22a5aea9f6

View File

@ -165,7 +165,8 @@ function spec(b) {
}; };
Transaction.prototype.calcHash = function calcHash() { Transaction.prototype.calcHash = function calcHash() {
return util.twoSha256(this.getBuffer()); this.hash = util.twoSha256(this.getBuffer());
return this.hash;
}; };
Transaction.prototype.checkHash = function checkHash() { Transaction.prototype.checkHash = function checkHash() {
@ -623,6 +624,7 @@ function spec(b) {
} }
this.lock_time = parser.word32le(); this.lock_time = parser.word32le();
this.calcHash();
}; };
var TransactionInputsCache = exports.TransactionInputsCache = var TransactionInputsCache = exports.TransactionInputsCache =