fix: change & fee value

This commit is contained in:
Vlad Stan 2022-08-04 13:47:20 +03:00
parent a0450cbdd9
commit 40ca51af0e

View file

@ -68,7 +68,7 @@ async function payment(path) {
return ( return (
this.selectedAmount - this.selectedAmount -
this.totalPayedAmount - this.totalPayedAmount -
this.feeRate * this.txSizeNoChange this.feeRate * this.txSize
) )
}, },
balance: function () { balance: function () {
@ -184,7 +184,8 @@ async function payment(path) {
if (!excludeChange) { if (!excludeChange) {
const change = this.createChangeOutput() const change = this.createChangeOutput()
if (this.changeAmount >= this.DUST_LIMIT) { const diffAmount = this.selectedAmount - this.totalPayedAmount
if (diffAmount >= this.DUST_LIMIT) {
tx.outputs.push(change) tx.outputs.push(change)
} }
} }