User @sebitt27 reported that his pool reward payments were paying extremely large fees (~0.074 DCR/kB). The cause was several bugs in the tx construction code, specifically in the function applyTxFees.
This PR starts by refactoring the tests for applyTxFees such that the existing behaviour can be characterized, and then goes on to fix the issues. The impact of the fixes (in the last two commits) can be observed by following the changes to the expected output amounts in the tests.
Using this new code the fee rate of the transaction shared by @sebitt27 is reduced to 0.000106216 DCR/kB, very close to the ideal value of 0.0001 DCR/kB.
User @sebitt27 reported that his pool reward payments were paying extremely large fees (~0.074 DCR/kB). The cause was several bugs in the tx construction code, specifically in the function
applyTxFees
.This PR starts by refactoring the tests for
applyTxFees
such that the existing behaviour can be characterized, and then goes on to fix the issues. The impact of the fixes (in the last two commits) can be observed by following the changes to the expected output amounts in the tests.Using this new code the fee rate of the transaction shared by @sebitt27 is reduced to 0.000106216 DCR/kB, very close to the ideal value of 0.0001 DCR/kB.