get rid of magic numbers in fee estimation
This commit is contained in:
parent
58ab0b631e
commit
7bd312de71
1 changed files with 5 additions and 1 deletions
|
@ -379,8 +379,12 @@ Transaction.prototype.validateSig = function(index, script, sig, pub) {
|
|||
|
||||
Transaction.feePerKb = 20000
|
||||
Transaction.prototype.estimateFee = function(feePerKb){
|
||||
var uncompressedInSize = 180
|
||||
var outSize = 34
|
||||
var fixedPadding = 34
|
||||
var feePerKb = feePerKb || Transaction.feePerKb
|
||||
var size = this.ins.length * 180 + this.outs.length * 34 + 10
|
||||
|
||||
var size = this.ins.length * uncompressedInSize + this.outs.length * outSize + fixedPadding
|
||||
var sizeInKb = BigInteger.valueOf(Math.ceil(size / 1000))
|
||||
|
||||
return BigInteger.valueOf(feePerKb).multiply(sizeInKb).intValue()
|
||||
|
|
Loading…
Reference in a new issue