lnbits / watchonly

MIT License
1 stars 2 forks source link

[bug] When sending out MAX amount (consolidation), an undesired 0 sats change output is created. #10

Open jr21M opened 9 months ago

jr21M commented 9 months ago

Watchonly forces to add a change address, even when consolidating funds (i.e. when sending out the MAX amount). This makes transaction have an one output with 0 sats. Therefore they are dropped as dust by the mempool.

Expected behaviour: When max amount is selected, no change address are created and transactions have only one output.

Running watchonly 0.22 with LNbits 0.12

jr21M commented 9 months ago

I think there is something wrong with this bit in the payment.js. There should never be an outputs when the diffAmount is 0. But for some reason it nonetheless gets created.

if (!excludeChange) { const change = this.createChangeOutput() const diffAmount = this.selectedAmount - this.totalPayedAmount if (diffAmount >= this.DUST_LIMIT) { tx.outputs.push(change) }