bitcoinjs-lib/test/network.js
2014-06-17 22:43:32 +08:00

23 lines
718 B
JavaScript

var assert = require('assert')
var networks = require('../src/networks')
var Transaction = require('../src/transaction')
var fixtureTxes = require('./fixtures/mainnet_tx')
var fixtureTx1Hex = fixtureTxes.prevTx
var fixtureTxBigHex = fixtureTxes.bigTx
describe('bitcoin', function() {
describe('estimateFee', function() {
var estimateFee = networks.bitcoin.estimateFee
it('works for fixture tx 1', function() {
var tx = Transaction.fromHex(fixtureTx1Hex)
assert.equal(estimateFee(tx.toBuffer().length), 10000)
})
it('works for fixture big tx', function() {
var tx = Transaction.fromHex(fixtureTxBigHex)
assert.equal(estimateFee(tx.toBuffer().length), 30000)
})
})
})