drop changeIndex from tx.

This commit is contained in:
Christopher Jeffrey 2016-06-23 12:18:28 -07:00
parent d7db03daa3
commit a70482c0c5
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 12 additions and 14 deletions

View File

@ -102,6 +102,12 @@ function MTX(options) {
utils.inherits(MTX, bcoin.tx);
/**
* Instantiate MTX from options.
* @param {Object} options
* @returns {MTX}
*/
MTX.fromOptions = function fromOptions(options) {
return new MTX(options);
};
@ -161,7 +167,7 @@ MTX.prototype.addInput = function addInput(options, index) {
* Build input script (or witness) templates (with
* OP_0 in place of signatures).
* @param {Number} index - Input index.
* @param {Address} addr - Address used to build. The address
* @param {KeyRing} addr - Address used to build. The address
* must be able to redeem the coin.
* @returns {Boolean} Whether the script was able to be built.
* @throws on unavailable coins.

View File

@ -37,7 +37,6 @@ var InvItem = bcoin.packets.InvItem;
* @property {Number} index - Transaction's index in the block tx vector.
* @property {Number} ps - "Pending Since": The time at which the transaction
* was first seen. Only non-zero on unconfirmed transactions.
* @property {Number} changeIndex - Index of the change output (-1 if unknown).
* @property {Number} height - Height of the block the
* transaction was included in (-1 if unconfirmed).
* @property {ReversedHash|null} rblock - Reversed block hash (uint256le).
@ -1863,7 +1862,6 @@ TX.prototype.inspect = function inspect() {
ts: this.ts,
ps: this.ps,
index: this.index,
changeIndex: this.changeIndex || -1,
version: this.version,
flag: this.flag,
inputs: this.inputs,
@ -1890,7 +1888,6 @@ TX.prototype.toJSON = function toJSON() {
ts: this.ts,
ps: this.ps,
index: this.index,
changeIndex: this.changeIndex || -1,
fee: utils.btc(this.getFee()),
confirmations: this.getConfirmations(),
version: this.version,
@ -1921,13 +1918,17 @@ TX.prototype.fromJSON = function fromJSON(json) {
assert(Array.isArray(json.inputs));
assert(Array.isArray(json.outputs));
assert(utils.isNumber(json.locktime));
assert(!json.block || typeof json.block === 'string');
assert(utils.isNumber(json.height));
assert(utils.isNumber(json.ts));
assert(utils.isNumber(json.ps));
assert(utils.isNumber(json.index));
this.block = json.block ? utils.revHex(json.block) : null;
this.height = json.height;
this.ts = json.ts;
this.ps = json.ps;
this.index = json.index;
this.changeIndex = json.changeIndex != null ? json.changeIndex : -1;
this.version = json.version;
@ -2183,7 +2184,6 @@ TX.prototype.frameWitness = function frameWitness(writer) {
TX.prototype.toExtended = function toExtended(saveCoins, writer) {
var height = this.height;
var index = this.index;
var changeIndex = this.changeIndex != null ? this.changeIndex : -1;
var p = bcoin.writer(writer);
var i, input;
@ -2193,9 +2193,6 @@ TX.prototype.toExtended = function toExtended(saveCoins, writer) {
if (index === -1)
index = 0x7fffffff;
if (changeIndex === -1)
changeIndex = 0x7fffffff;
this.toRaw(p);
p.writeU32(height);
@ -2203,7 +2200,6 @@ TX.prototype.toExtended = function toExtended(saveCoins, writer) {
p.writeU32(index);
p.writeU32(this.ts);
p.writeU32(this.ps);
// p.writeU32(changeIndex);
if (saveCoins) {
p.writeVarint(this.inputs.length);
@ -2244,7 +2240,6 @@ TX.prototype.fromExtended = function fromExtended(data, saveCoins) {
this.index = p.readU32();
this.ts = p.readU32();
this.ps = p.readU32();
// this.changeIndex = p.readU32();
if (this.block === constants.NULL_HASH)
this.block = null;
@ -2255,9 +2250,6 @@ TX.prototype.fromExtended = function fromExtended(data, saveCoins) {
if (this.index === 0x7fffffff)
this.index = -1;
if (this.changeIndex === 0x7fffffff)
this.changeIndex = -1;
if (saveCoins) {
coinCount = p.readVarint();
for (i = 0; i < coinCount; i++) {