fix tx.hash.
This commit is contained in:
parent
06f973fb72
commit
e25ba1c85c
|
@ -269,12 +269,12 @@ Bitcoin.prototype._pollMempool = function() {
|
||||||
tx = bitcoin.tx(tx);
|
tx = bitcoin.tx(tx);
|
||||||
|
|
||||||
// XXX Bad workaround
|
// XXX Bad workaround
|
||||||
if (self._emitted[tx.hash]) {
|
if (self._emitted[tx.txid]) {
|
||||||
return setImmediate(function() {
|
return setImmediate(function() {
|
||||||
return nextTx();
|
return nextTx();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
self._emitted[tx.hash] = true;
|
self._emitted[tx.txid] = true;
|
||||||
|
|
||||||
self.emit('mptx', tx);
|
self.emit('mptx', tx);
|
||||||
self.emit('tx', tx);
|
self.emit('tx', tx);
|
||||||
|
@ -559,7 +559,6 @@ Transaction.fill = function(tx, options) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// NOTE: Could just call tx.GetHash().ToString() in C++
|
// NOTE: Could just call tx.GetHash().ToString() in C++
|
||||||
Transaction.prototype.hash =
|
|
||||||
Transaction.prototype.getHash = function(enc) {
|
Transaction.prototype.getHash = function(enc) {
|
||||||
if (!this._hash) {
|
if (!this._hash) {
|
||||||
this._hash = utils.dsha256(this.toBinary(), 'hex');
|
this._hash = utils.dsha256(this.toBinary(), 'hex');
|
||||||
|
|
|
@ -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>("hex"), NanNew<String>(strHex));
|
||||||
|
|
||||||
jstx->Set(NanNew<String>("txid"), NanNew<String>(ctx.GetHash().GetHex()));
|
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>("version"), NanNew<Number>(ctx.nVersion));
|
||||||
jstx->Set(NanNew<String>("locktime"), NanNew<Number>(ctx.nLockTime));
|
jstx->Set(NanNew<String>("locktime"), NanNew<Number>(ctx.nLockTime));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue