Move fee estimation into networks.js
This commit is contained in:
parent
79ec61d085
commit
122b613eaf
3 changed files with 36 additions and 5 deletions
test
23
test/network.js
Normal file
23
test/network.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
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)
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue