Browse Source

Cleanup test

patch-2
William Wolf 10 years ago
parent
commit
32583fbbe3
  1. 4
      lib/block/merkleblock.js
  2. 6
      test/merkleblock.js

4
lib/block/merkleblock.js

@ -107,7 +107,7 @@ MerkleBlock.prototype.toBufferWriter = function toBufferWriter(bw) {
bw.write(new Buffer(this.hashes[i], 'hex'));
}
bw.writeVarintNum(this.flags.length);
for (var i = 0; i < this.flags.length; i++) {
for (i = 0; i < this.flags.length; i++) {
bw.writeUInt8(this.flags[i]);
}
return bw;
@ -149,7 +149,7 @@ MerkleBlock._fromBufferReader = function _fromBufferReader(br) {
}
var numFlags = br.readVarintNum();
info.flags = [];
for (var i = 0; i < numFlags; i++) {
for (i = 0; i < numFlags; i++) {
info.flags.push(br.readUInt8());
}
return info;

6
test/merkleblock.js

@ -1,9 +1,7 @@
'use strict';
var bitcore = require('..'),
BufferUtil = bitcore.util.buffer,
MerkleBlock = bitcore.MerkleBlock,
BlockHeader = bitcore.BlockHeader,
BufferReader = bitcore.encoding.BufferReader,
BufferWriter = bitcore.encoding.BufferWriter,
data = require('./data/merkleblocks.js');
@ -71,6 +69,10 @@ describe('MerkleBlock', function() {
should.exist(block.numTransactions);
should.exist(block.hashes);
should.exist(block.flags);
should.exist(b.header);
should.exist(b.numTransactions);
should.exist(b.hashes);
should.exist(b.flags);
});
});

Loading…
Cancel
Save