dcrwallet icon indicating copy to clipboard operation
dcrwallet copied to clipboard

sendtoaddress is missing a subtractfeefromamount option

Open jrick opened this issue 6 years ago • 4 comments

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.

jrick avatar Oct 25 '18 18:10 jrick

Can I take this issue?

sefbkn avatar Nov 10 '18 19:11 sefbkn

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.

jrick avatar Nov 12 '18 14:11 jrick

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.

sefbkn avatar Jun 19 '19 21:06 sefbkn

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.

jrick avatar Jun 19 '19 23:06 jrick