Bitshala-Incubator / silent-pay

a TS library for silent payments
MIT License
11 stars 12 forks source link

Drop change to fee if amount is dust #26

Closed theanmolsharma closed 7 months ago

theanmolsharma commented 8 months ago

In CoinSelector. select(), we should check if the change amount is greater than the cost of change. If not so, we should drop it to fee.


LONG_TERM_FEERATE = 5 # in sats/vB
constOfChangeOutput = outputSize * currentFeerate;
constOfSpendingChange = inputSizeOfChangeUTXO * LONG_TERM_FEERATE;

costOfChange = constOfChangeOutput + constOfSpendingChange
Ayush170-Future commented 7 months ago

We should close this.