dcrwallet
dcrwallet copied to clipboard
sendtoaddress is missing a subtractfeefromamount option
With this option, the fee is subtracted from the amount paid to the address in the request, rather than subtracting a fee from the change output.
Can I take this issue?
Sure. For this you will want to create a new function in the txauthor package that performs this behavior, since it would be impossible to add it to the existing NewUnsignedTransaction. Instead of creating the transaction from a slice of outputs, there should only be a single output, and the output amount is decreased by the required fee.
In the case where change would be dust, should the operation be considered valid?
Giving dust-change to the miner seems to conflict with the expected behavior of the recipient fully funding the relay fee. Policy tends towards eliminating dust utxos and could be called out as an edge case in the command's description, but it's not obvious how this should behave by default.
Increasing the tx fee by leaving off the change output entirely would be the simplest correct way, and it is a rare edge case so I don't see any issues with doing that.