Skip to content

Commit

Permalink
modify get_base_satoshi_per_byte -> get_base_satoshi_per_byte
Browse files Browse the repository at this point in the history
  • Loading branch information
you21979 committed Jan 25, 2017
1 parent f7de0a4 commit 7b1fa76
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions index.js
Expand Up @@ -19,9 +19,12 @@ var STATIC_INPUT_P2SH_LEN = PREVOUT_LEN + VARINT16_LEN + (OPCODE_LEN * 4) + SEQU
var STATIC_OUTPUT_LEN = AMOUNT_LEN + VARINT8_LEN + SCRIPT_PUBKEY_LEN;
var STATIC_HEADER_LEN = VERSION_LEN + VARINT8_LEN + VARINT8_LEN + LOCKTIME_LEN;

TxFees.BASE_BYTE_PER_SATOSHI = 10;
TxFees.BASE_SATOSHI_PER_BYTE = 10;

TxFees.get_base_byte_per_satoshi = TxFees.getBaseBytePerSatoshi = function(){ return TxFees.BASE_BYTE_PER_SATOSHI }
TxFees.get_base_satoshi_per_byte = function(){ return TxFees.BASE_SATOSHI_PER_BYTE }

// next delete
TxFees.getBaseBytePerSatoshi = TxFees.get_base_satoshi_per_byte

TxFees.p2pkh_calc_input_byte = function(){ return STATIC_INPUT_P2PKH_LEN }

Expand All @@ -38,7 +41,7 @@ TxFees.tx_calc_fee = function(byte, byte_per_satoshi){
}

TxFees.p2pkh_tx_calc_fee = function(input_num, output_num){
return TxFees.tx_calc_fee( TxFees.tx_calc_byte(TxFees.p2pkh_calc_input_byte(), input_num, output_num), TxFees.get_base_byte_per_satoshi() )
return TxFees.tx_calc_fee( TxFees.tx_calc_byte(TxFees.p2pkh_calc_input_byte(), input_num, output_num), TxFees.get_base_satoshi_per_byte() )
}

TxFees.p2pkh_tx_calc_byte = function(input_num, output_num){
Expand All @@ -48,7 +51,7 @@ TxFees.p2pkh_tx_calc_byte = function(input_num, output_num){
TxFees.p2sh_tx_calc_fee_create = function(m, n){
var input_byte = TxFees.p2sh_calc_input_byte(m, n)
return function(input_num, output_num){
return TxFees.tx_calc_fee( TxFees.tx_calc_byte(input_byte, input_num, output_num), TxFees.get_base_byte_per_satoshi() )
return TxFees.tx_calc_fee( TxFees.tx_calc_byte(input_byte, input_num, output_num), TxFees.get_base_satoshi_per_byte() )
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"author": "Yuki Akiyama",
"name": "bitcoin-util-fee",
"version": "0.0.4",
"version": "0.0.5",
"private": false,
"dependencies": {
},
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Expand Up @@ -3,7 +3,7 @@ var assert = require('assert');
var util = require('..');

describe('test', function () {
util.BASE_BYTE_PER_SATOSHI = 1;
util.BASE_SATOSHI_PER_BYTE = 1;

describe('p2pkh test', function () {
it('p2pkh fee', function () {
Expand Down

0 comments on commit 7b1fa76

Please sign in to comment.