dcrwallet icon indicating copy to clipboard operation
dcrwallet copied to clipboard

Fee estimation must provide accurate results with arbitrary change script sizes

Open jrick opened this issue 7 years ago • 0 comments

Fee estimation, as performed by txauthor.NewUnsignedTransaction, currently assumes that all change outputs will have the output script size for a P2PKH output. This is not always the case and could result in unnecessarily high fees, or fees too low for the fee rate policy.

To solve this issue, txauthor.NewUnsignedTransaction will need to be passed the size of a change script. The best way to solve this would be to change the ChangeSource type from a function to an interface, which provides a method for the existing function and a second method to return the size of the change script.

jrick avatar Jun 01 '18 14:06 jrick