Added test data for blocks from bitcoin core.
This commit is contained in:
parent
011f601e37
commit
b6ba5dbc5a
|
@ -1,5 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
var assert = require('assert');
|
||||||
var bitcore = require('..');
|
var bitcore = require('..');
|
||||||
var BN = require('../lib/crypto/bn');
|
var BN = require('../lib/crypto/bn');
|
||||||
var BufferReader = bitcore.encoding.BufferReader;
|
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 dataRawBlockBinary = fs.readFileSync('test/data/blk86756-testnet.dat', 'binary');
|
||||||
var dataJson = fs.readFileSync('test/data/blk86756-testnet.json').toString();
|
var dataJson = fs.readFileSync('test/data/blk86756-testnet.json').toString();
|
||||||
var data = require('./data/blk86756-testnet');
|
var data = require('./data/blk86756-testnet');
|
||||||
|
var dataBlocks = require('./data/bitcoind/blocks');
|
||||||
|
|
||||||
describe('Block', function() {
|
describe('Block', function() {
|
||||||
|
|
||||||
|
@ -64,6 +66,13 @@ describe('Block', function() {
|
||||||
should.exist(b.txs);
|
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() {
|
describe('#fromRawBlock', function() {
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue