bitcore icon indicating copy to clipboard operation
bitcore copied to clipboard

getFee behaviour does not match description

Open natureisbestNFT opened this issue 2 years ago • 0 comments

https://github.com/bitpay/bitcore/blob/7dd58ea888105ca2d0ab95e0bad3c68a923640d7/packages/bitcore-lib/lib/transaction/transaction.js#L992

  • If there's no fee set and no change address,
  • estimate the fee based on size.

line 1004: // if no change output is set, fees should equal all the unspent amount if (!this._changeScript) { return this._getUnspentValue(); }

Comment for function says estimate fee, but if inputs=outputs it will return 0 instead of estimating. And even if they are not equal it will return 'all the unspent amount' instead of estimating an appropriate fee. So function does not do what it says it will.

This problem is the same for dogecoin https://github.com/bitpay/bitcore/blob/master/packages/bitcore-lib-doge/lib/transaction/transaction.js#L999

natureisbestNFT avatar Jul 25 '23 11:07 natureisbestNFT