Added test data for blocks from bitcoin core.

This commit is contained in:
Braydon Fuller 2015-01-09 16:50:24 -05:00
parent 011f601e37
commit b6ba5dbc5a
2 changed files with 36 additions and 0 deletions

View File

@ -1,5 +1,6 @@
'use strict';
var assert = require('assert');
var bitcore = require('..');
var BN = require('../lib/crypto/bn');
var BufferReader = bitcore.encoding.BufferReader;
@ -17,6 +18,7 @@ var dataRawBlockBuffer = fs.readFileSync('test/data/blk86756-testnet.dat');
var dataRawBlockBinary = fs.readFileSync('test/data/blk86756-testnet.dat', 'binary');
var dataJson = fs.readFileSync('test/data/blk86756-testnet.json').toString();
var data = require('./data/blk86756-testnet');
var dataBlocks = require('./data/bitcoind/blocks');
describe('Block', function() {
@ -64,6 +66,13 @@ describe('Block', function() {
should.exist(b.txs);
});
it('should properly deserialize blocks', function() {
dataBlocks.forEach(function(block){
var b = Block.fromBuffer(new Buffer(block.data, 'hex'));
b.txs.length.should.equal(block.transactions);
});
});
});
describe('#fromRawBlock', function() {

File diff suppressed because one or more lines are too long