Merge pull request #15 from maraoz/feature/tx-hash-on-parse

make transactions calculate their hash on parse
This commit is contained in:
Jeff Garzik 2014-01-10 09:19:03 -08:00
commit 9aef8d5ad5
1 changed files with 3 additions and 1 deletions

View File

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