fix tx.hash.

This commit is contained in:
Christopher Jeffrey 2014-10-02 20:18:37 -07:00
parent 06f973fb72
commit e25ba1c85c
2 changed files with 3 additions and 3 deletions

View File

@ -269,12 +269,12 @@ Bitcoin.prototype._pollMempool = function() {
tx = bitcoin.tx(tx);
// XXX Bad workaround
if (self._emitted[tx.hash]) {
if (self._emitted[tx.txid]) {
return setImmediate(function() {
return nextTx();
});
}
self._emitted[tx.hash] = true;
self._emitted[tx.txid] = true;
self.emit('mptx', tx);
self.emit('tx', tx);
@ -559,7 +559,6 @@ Transaction.fill = function(tx, options) {
};
// NOTE: Could just call tx.GetHash().ToString() in C++
Transaction.prototype.hash =
Transaction.prototype.getHash = function(enc) {
if (!this._hash) {
this._hash = utils.dsha256(this.toBinary(), 'hex');

View File

@ -2456,6 +2456,7 @@ cblock_to_jsblock(const CBlock& cblock, const CBlockIndex* cblock_index, Local<O
jstx->Set(NanNew<String>("hex"), NanNew<String>(strHex));
jstx->Set(NanNew<String>("txid"), NanNew<String>(ctx.GetHash().GetHex()));
jstx->Set(NanNew<String>("hash"), NanNew<String>(ctx.GetHash().GetHex()));
jstx->Set(NanNew<String>("version"), NanNew<Number>(ctx.nVersion));
jstx->Set(NanNew<String>("locktime"), NanNew<Number>(ctx.nLockTime));