Browse Source

tests: add bitcoin core block fixtures

Data from
https://github.com/bitcoin/bitcoin/blob/master/src/test/bloom_tests.cpp
hk-custom-address
Daniel Cousens 10 years ago
parent
commit
837424ed16
  1. 16
      test/bitcoin.core.js
  2. 27
      test/fixtures/core/blocks.json

16
test/bitcoin.core.js

@ -6,15 +6,18 @@ var base58check = require('bs58check')
var Bitcoin = require('../')
var Address = Bitcoin.Address
var networks = Bitcoin.networks
var Block = Bitcoin.Block
var ECKey = Bitcoin.ECKey
var ECSignature = Bitcoin.ECSignature
var Transaction = Bitcoin.Transaction
var Script = Bitcoin.Script
var networks = Bitcoin.networks
var base58_encode_decode = require('./fixtures/core/base58_encode_decode.json')
var base58_keys_invalid = require('./fixtures/core/base58_keys_invalid.json')
var base58_keys_valid = require('./fixtures/core/base58_keys_valid.json')
var blocks_valid = require('./fixtures/core/blocks.json')
var sig_canonical = require('./fixtures/core/sig_canonical.json')
var sig_noncanonical = require('./fixtures/core/sig_noncanonical.json')
var sighash = require('./fixtures/core/sighash.json')
@ -134,6 +137,17 @@ describe('Bitcoin-core', function () {
})
})
describe('Block', function () {
blocks_valid.forEach(function (f) {
it('fromHex can parse ' + f.id, function () {
var block = Block.fromHex(f.hex)
assert.equal(block.getId(), f.id)
assert.equal(block.transactions.length, f.transactions)
})
})
})
// tx_valid
describe('Transaction', function () {
tx_valid.forEach(function (f) {

27
test/fixtures/core/blocks.json

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save