lib: use TX instead of Tx everywhere

This commit is contained in:
Fedor Indutny 2014-05-06 15:02:09 +04:00
parent f139ce2d91
commit cdd3dbefb1
4 changed files with 15 additions and 15 deletions

View File

@ -12,7 +12,7 @@ function Block(data) {
this.ts = data.ts;
this.bits = data.bits;
this.nonce = data.nonce;
this.totalTx = data.totalTx;
this.totalTX = data.totalTX;
this.hashes = data.hashes.map(function(hash) {
return utils.toHex(hash);
});

View File

@ -54,7 +54,7 @@ function Pool(options) {
// Minimum verification depth
minDepth: options.minValidateDepth || 0,
// getTx map
// getTX map
map: {}
};
@ -443,7 +443,7 @@ Pool.prototype._doRequests = function _doRequests() {
}
};
Pool.prototype.getTx = function getTx(hash, range, cb) {
Pool.prototype.getTX = function getTX(hash, range, cb) {
hash = utils.toHex(hash);
if (typeof range === 'function') {
@ -503,7 +503,7 @@ Pool.prototype.getTx = function getTx(hash, range, cb) {
}
};
Pool.prototype.sendTx = function sendTx(tx) {
Pool.prototype.sendTX = function sendTX(tx) {
var e = new EventEmitter();
var self = this;

View File

@ -98,7 +98,7 @@ Parser.prototype.parsePayload = function parsePayload(cmd, p) {
else if (cmd === 'block')
return this.parseBlock(p);
else if (cmd === 'tx')
return this.parseTx(p);
return this.parseTX(p);
else if (cmd === 'reject')
return this.parseReject(p);
else
@ -204,7 +204,7 @@ Parser.prototype.parseMerkleBlock = function parseMerkleBlock(p) {
ts: readU32(p, 68),
bits: readU32(p, 72),
nonce: readU32(p, 76),
totalTx: readU32(p, 80),
totalTX: readU32(p, 80),
hashes: hashes,
flags: flags
};
@ -221,11 +221,11 @@ Parser.prototype.parseBlock = function parseBlock(p) {
ts: readU32(p, 68),
bits: readU32(p, 72),
nonce: readU32(p, 76),
totalTx: readU32(p, 80)
totalTX: readU32(p, 80)
};
};
Parser.prototype.parseTxIn = function parseTxIn(p) {
Parser.prototype.parseTXIn = function parseTXIn(p) {
if (p.length < 41)
return this._error('Invalid tx_in size');
@ -246,7 +246,7 @@ Parser.prototype.parseTxIn = function parseTxIn(p) {
};
};
Parser.prototype.parseTxOut = function parseTxOut(p) {
Parser.prototype.parseTXOut = function parseTXOut(p) {
if (p.length < 9)
return this._error('Invalid tx_out size');
@ -263,7 +263,7 @@ Parser.prototype.parseTxOut = function parseTxOut(p) {
};
};
Parser.prototype.parseTx = function parseTx(p) {
Parser.prototype.parseTX = function parseTX(p) {
if (p.length < 60)
return this._error('Invalid tx size');
@ -277,7 +277,7 @@ Parser.prototype.parseTx = function parseTx(p) {
var txIn = new Array(inCount);
for (var i = 0; i < inCount; i++) {
var tx = this.parseTxIn(p.slice(off));
var tx = this.parseTXIn(p.slice(off));
if (!tx)
return;
txIn[i] = tx;
@ -297,7 +297,7 @@ Parser.prototype.parseTx = function parseTx(p) {
var txOut = new Array(outCount);
for (var i = 0; i < outCount; i++) {
var tx = this.parseTxOut(p.slice(off));
var tx = this.parseTXOut(p.slice(off));
if (!tx)
return;
txOut[i] = tx;

View File

@ -42,13 +42,13 @@ describe('TX', function() {
'2e88ac00000000';
it('should decode/encode with parser/framer', function() {
var tx = bcoin.tx(parser.parseTx(bcoin.utils.toArray(raw, 'hex')));
var tx = bcoin.tx(parser.parseTX(bcoin.utils.toArray(raw, 'hex')));
assert.equal(bcoin.utils.toHex(tx.render()), raw);
});
it('should be verifiable', function() {
var tx = bcoin.tx(parser.parseTx(bcoin.utils.toArray(raw, 'hex')));
tx.input(bcoin.tx(parser.parseTx(bcoin.utils.toArray(inp, 'hex'))), 0);
var tx = bcoin.tx(parser.parseTX(bcoin.utils.toArray(raw, 'hex')));
tx.input(bcoin.tx(parser.parseTX(bcoin.utils.toArray(inp, 'hex'))), 0);
assert(tx.verify());
});