tx: encode as hex
This commit is contained in:
parent
90ea2e24d1
commit
d4f11676c7
@ -126,6 +126,8 @@ TXPool.prototype._storeTX = function _storeTX(hash, tx) {
|
||||
TXPool.prototype.unspent = function unspent() {
|
||||
return Object.keys(this._unspent).map(function(key) {
|
||||
return this._unspent[key];
|
||||
}, this).filter(function(item) {
|
||||
return this._wallet.own(item.tx, item.index);
|
||||
}, this);
|
||||
};
|
||||
|
||||
|
||||
@ -184,12 +184,12 @@ TX.prototype.toJSON = function toJSON() {
|
||||
// Compact representation
|
||||
var ts = new Array(4);
|
||||
bcoin.utils.writeU32(ts, this.ts, 0);
|
||||
return utils.toBase58(this.render().concat(ts));
|
||||
return utils.toHex(this.render().concat(ts));
|
||||
};
|
||||
|
||||
TX.fromJSON = function fromJSON(json) {
|
||||
// Compact representation
|
||||
var data = utils.fromBase58(json);
|
||||
var data = utils.toArray(json, 'hex');
|
||||
var tx = data.slice(0, -4);
|
||||
var ts = bcoin.utils.readU32(data, data.length - 4);
|
||||
|
||||
|
||||
@ -142,7 +142,7 @@ Wallet.prototype.own = function own(tx, index) {
|
||||
var hash = this.getHash();
|
||||
var key = this.getPublicKey();
|
||||
var outputs = tx.outputs.filter(function(output, i) {
|
||||
if (index && index !== i)
|
||||
if (index !== undefined && index !== i)
|
||||
return false;
|
||||
|
||||
var s = output.script;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user