drop changeIndex from tx.
This commit is contained in:
parent
d7db03daa3
commit
a70482c0c5
@ -102,6 +102,12 @@ function MTX(options) {
|
|||||||
|
|
||||||
utils.inherits(MTX, bcoin.tx);
|
utils.inherits(MTX, bcoin.tx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiate MTX from options.
|
||||||
|
* @param {Object} options
|
||||||
|
* @returns {MTX}
|
||||||
|
*/
|
||||||
|
|
||||||
MTX.fromOptions = function fromOptions(options) {
|
MTX.fromOptions = function fromOptions(options) {
|
||||||
return new MTX(options);
|
return new MTX(options);
|
||||||
};
|
};
|
||||||
@ -161,7 +167,7 @@ MTX.prototype.addInput = function addInput(options, index) {
|
|||||||
* Build input script (or witness) templates (with
|
* Build input script (or witness) templates (with
|
||||||
* OP_0 in place of signatures).
|
* OP_0 in place of signatures).
|
||||||
* @param {Number} index - Input index.
|
* @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.
|
* must be able to redeem the coin.
|
||||||
* @returns {Boolean} Whether the script was able to be built.
|
* @returns {Boolean} Whether the script was able to be built.
|
||||||
* @throws on unavailable coins.
|
* @throws on unavailable coins.
|
||||||
|
|||||||
@ -37,7 +37,6 @@ var InvItem = bcoin.packets.InvItem;
|
|||||||
* @property {Number} index - Transaction's index in the block tx vector.
|
* @property {Number} index - Transaction's index in the block tx vector.
|
||||||
* @property {Number} ps - "Pending Since": The time at which the transaction
|
* @property {Number} ps - "Pending Since": The time at which the transaction
|
||||||
* was first seen. Only non-zero on unconfirmed transactions.
|
* 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
|
* @property {Number} height - Height of the block the
|
||||||
* transaction was included in (-1 if unconfirmed).
|
* transaction was included in (-1 if unconfirmed).
|
||||||
* @property {ReversedHash|null} rblock - Reversed block hash (uint256le).
|
* @property {ReversedHash|null} rblock - Reversed block hash (uint256le).
|
||||||
@ -1863,7 +1862,6 @@ TX.prototype.inspect = function inspect() {
|
|||||||
ts: this.ts,
|
ts: this.ts,
|
||||||
ps: this.ps,
|
ps: this.ps,
|
||||||
index: this.index,
|
index: this.index,
|
||||||
changeIndex: this.changeIndex || -1,
|
|
||||||
version: this.version,
|
version: this.version,
|
||||||
flag: this.flag,
|
flag: this.flag,
|
||||||
inputs: this.inputs,
|
inputs: this.inputs,
|
||||||
@ -1890,7 +1888,6 @@ TX.prototype.toJSON = function toJSON() {
|
|||||||
ts: this.ts,
|
ts: this.ts,
|
||||||
ps: this.ps,
|
ps: this.ps,
|
||||||
index: this.index,
|
index: this.index,
|
||||||
changeIndex: this.changeIndex || -1,
|
|
||||||
fee: utils.btc(this.getFee()),
|
fee: utils.btc(this.getFee()),
|
||||||
confirmations: this.getConfirmations(),
|
confirmations: this.getConfirmations(),
|
||||||
version: this.version,
|
version: this.version,
|
||||||
@ -1921,13 +1918,17 @@ TX.prototype.fromJSON = function fromJSON(json) {
|
|||||||
assert(Array.isArray(json.inputs));
|
assert(Array.isArray(json.inputs));
|
||||||
assert(Array.isArray(json.outputs));
|
assert(Array.isArray(json.outputs));
|
||||||
assert(utils.isNumber(json.locktime));
|
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.block = json.block ? utils.revHex(json.block) : null;
|
||||||
this.height = json.height;
|
this.height = json.height;
|
||||||
this.ts = json.ts;
|
this.ts = json.ts;
|
||||||
this.ps = json.ps;
|
this.ps = json.ps;
|
||||||
this.index = json.index;
|
this.index = json.index;
|
||||||
this.changeIndex = json.changeIndex != null ? json.changeIndex : -1;
|
|
||||||
|
|
||||||
this.version = json.version;
|
this.version = json.version;
|
||||||
|
|
||||||
@ -2183,7 +2184,6 @@ TX.prototype.frameWitness = function frameWitness(writer) {
|
|||||||
TX.prototype.toExtended = function toExtended(saveCoins, writer) {
|
TX.prototype.toExtended = function toExtended(saveCoins, writer) {
|
||||||
var height = this.height;
|
var height = this.height;
|
||||||
var index = this.index;
|
var index = this.index;
|
||||||
var changeIndex = this.changeIndex != null ? this.changeIndex : -1;
|
|
||||||
var p = bcoin.writer(writer);
|
var p = bcoin.writer(writer);
|
||||||
var i, input;
|
var i, input;
|
||||||
|
|
||||||
@ -2193,9 +2193,6 @@ TX.prototype.toExtended = function toExtended(saveCoins, writer) {
|
|||||||
if (index === -1)
|
if (index === -1)
|
||||||
index = 0x7fffffff;
|
index = 0x7fffffff;
|
||||||
|
|
||||||
if (changeIndex === -1)
|
|
||||||
changeIndex = 0x7fffffff;
|
|
||||||
|
|
||||||
this.toRaw(p);
|
this.toRaw(p);
|
||||||
|
|
||||||
p.writeU32(height);
|
p.writeU32(height);
|
||||||
@ -2203,7 +2200,6 @@ TX.prototype.toExtended = function toExtended(saveCoins, writer) {
|
|||||||
p.writeU32(index);
|
p.writeU32(index);
|
||||||
p.writeU32(this.ts);
|
p.writeU32(this.ts);
|
||||||
p.writeU32(this.ps);
|
p.writeU32(this.ps);
|
||||||
// p.writeU32(changeIndex);
|
|
||||||
|
|
||||||
if (saveCoins) {
|
if (saveCoins) {
|
||||||
p.writeVarint(this.inputs.length);
|
p.writeVarint(this.inputs.length);
|
||||||
@ -2244,7 +2240,6 @@ TX.prototype.fromExtended = function fromExtended(data, saveCoins) {
|
|||||||
this.index = p.readU32();
|
this.index = p.readU32();
|
||||||
this.ts = p.readU32();
|
this.ts = p.readU32();
|
||||||
this.ps = p.readU32();
|
this.ps = p.readU32();
|
||||||
// this.changeIndex = p.readU32();
|
|
||||||
|
|
||||||
if (this.block === constants.NULL_HASH)
|
if (this.block === constants.NULL_HASH)
|
||||||
this.block = null;
|
this.block = null;
|
||||||
@ -2255,9 +2250,6 @@ TX.prototype.fromExtended = function fromExtended(data, saveCoins) {
|
|||||||
if (this.index === 0x7fffffff)
|
if (this.index === 0x7fffffff)
|
||||||
this.index = -1;
|
this.index = -1;
|
||||||
|
|
||||||
if (this.changeIndex === 0x7fffffff)
|
|
||||||
this.changeIndex = -1;
|
|
||||||
|
|
||||||
if (saveCoins) {
|
if (saveCoins) {
|
||||||
coinCount = p.readVarint();
|
coinCount = p.readVarint();
|
||||||
for (i = 0; i < coinCount; i++) {
|
for (i = 0; i < coinCount; i++) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user