various small changes to bitcore

This commit is contained in:
Manuel Araoz 2014-01-08 15:25:49 -03:00
parent 0bdcfa3045
commit b3f36c3e72
4 changed files with 15 additions and 4 deletions

View File

@ -64,7 +64,7 @@ function spec(b) {
var txCount = parser.varInt();
for (i = 0; i < txCount; i++) {
for (var i = 0; i < txCount; i++) {
var tx = new Transaction();
tx.parse(parser);
this.txs.push(tx);

View File

@ -476,7 +476,7 @@ function spec(b) {
lock_time: tx.lock_time,
ins: tx.ins,
outs: tx.outs,
tx: tx,
tx: tx,
};
case 'getblocks':

View File

@ -553,7 +553,7 @@ function spec(b) {
var ins = this.ins.map(function (txin) {
var txinObj = {
prev_out: {
hash: new Buffer(txin.getOutpointHash()).reverse().toString(hex),
hash: new Buffer(txin.getOutpointHash()).reverse().toString('hex'),
n: txin.getOutpointIndex()
}
};

View File

@ -1,7 +1,18 @@
exports.MSG = {
MSG = {
TX: 1,
BLOCK: 2,
FILTERED_BLOCK: 3,
};
MSG.to_str = function(t) {
switch(t) {
case MSG.TX: return 'transaction';
case MSG.BLOCK: return 'block';
case MSG.FILTERED_BLOCK: return 'filtered block';
default: return 'unknown';
}
}
exports.MSG = MSG;