bitpay / bitcore

A full stack for bitcoin and blockchain-based applications
https://bitcore.io/
MIT License
4.8k stars 2.07k forks source link

getFee behaviour does not match description #3612

Open natureisbestNFT opened 11 months ago

natureisbestNFT commented 11 months ago

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

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