bitcore-lib icon indicating copy to clipboard operation
bitcore-lib copied to clipboard

Question about feePerKb

Open khrisanfov opened this issue 8 years ago • 2 comments

I see that if transaction size is smaller than 1 kb then total fee is equal to feePerKb value.

Transaction._estimateFee = function(size, amountAvailable, feePerKb) {         
  var fee = Math.ceil(size / 1000) * (feePerKb || Transaction.FEE_PER_KB);     
  if (amountAvailable > fee) {                                                 
    size += Transaction.CHANGE_OUTPUT_MAX_SIZE;                                
  }                                                                            
  return Math.ceil(size / 1000) * (feePerKb || Transaction.FEE_PER_KB);        
}; 

Is this a bug or a feature?

I am expecting it to work like this:

Math.ceil(size / 1000 * (feePerKb || Transaction.FEE_PER_KB)); instead of Math.ceil(size / 1000) * (feePerKb || Transaction.FEE_PER_KB);

khrisanfov avatar Dec 25 '17 16:12 khrisanfov

I was about to make an issue about the same thing

jguthrie7 avatar Apr 17 '18 16:04 jguthrie7

+1

skaplan avatar Sep 20 '18 01:09 skaplan