tests: add bitcoin core block fixtures
Data from https://github.com/bitcoin/bitcoin/blob/master/src/test/bloom_tests.cpp
This commit is contained in:
parent
b13271477c
commit
837424ed16
2 changed files with 42 additions and 1 deletions
test
|
@ -6,15 +6,18 @@ var base58check = require('bs58check')
|
||||||
|
|
||||||
var Bitcoin = require('../')
|
var Bitcoin = require('../')
|
||||||
var Address = Bitcoin.Address
|
var Address = Bitcoin.Address
|
||||||
var networks = Bitcoin.networks
|
var Block = Bitcoin.Block
|
||||||
var ECKey = Bitcoin.ECKey
|
var ECKey = Bitcoin.ECKey
|
||||||
var ECSignature = Bitcoin.ECSignature
|
var ECSignature = Bitcoin.ECSignature
|
||||||
var Transaction = Bitcoin.Transaction
|
var Transaction = Bitcoin.Transaction
|
||||||
var Script = Bitcoin.Script
|
var Script = Bitcoin.Script
|
||||||
|
|
||||||
|
var networks = Bitcoin.networks
|
||||||
|
|
||||||
var base58_encode_decode = require('./fixtures/core/base58_encode_decode.json')
|
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_invalid = require('./fixtures/core/base58_keys_invalid.json')
|
||||||
var base58_keys_valid = require('./fixtures/core/base58_keys_valid.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_canonical = require('./fixtures/core/sig_canonical.json')
|
||||||
var sig_noncanonical = require('./fixtures/core/sig_noncanonical.json')
|
var sig_noncanonical = require('./fixtures/core/sig_noncanonical.json')
|
||||||
var sighash = require('./fixtures/core/sighash.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
|
// tx_valid
|
||||||
describe('Transaction', function () {
|
describe('Transaction', function () {
|
||||||
tx_valid.forEach(function (f) {
|
tx_valid.forEach(function (f) {
|
||||||
|
|
27
test/fixtures/core/blocks.json
vendored
Normal file
27
test/fixtures/core/blocks.json
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue