fix tx.render() and avoidFeeSnipping().

This commit is contained in:
Christopher Jeffrey 2016-02-02 20:28:35 -08:00
parent f6fe37be6b
commit 3158f57e0f

View File

@ -103,7 +103,7 @@ TX.prototype.hash = function hash(enc, force) {
TX.prototype.render = function render(force) {
if (!force && this.network && this._raw)
return this._raw.slice();
return utils.toArray(this._raw).slice();
return bcoin.protocol.framer.tx(this);
};
@ -1441,10 +1441,10 @@ TX.prototype.avoidFeeSnipping = function avoidFeeSnipping() {
if (!this.chain)
return;
this.locktime = this.chain.height();
this.setLocktime(this.chain.height());
if ((Math.random() * 10 | 0) === 0)
this.locktime = Math.max(0, this.locktime - (Math.random() * 100 | 0));
this.setLocktime(Math.max(0, this.locktime - (Math.random() * 100 | 0)));
};
TX.prototype.setLocktime = function setLocktime(locktime) {