-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't ignore the fee when it's explicitly specified. #1214
Conversation
…f the inputs. Don't ignore the fee when it's explicitly specified.
I'm looking at how the coverage could have decreased. |
LGTM |
I found a problem when investigating the coverage. I'll write a test and fix it. Is there a way to amend the pull request or do I have to make a new pull request? |
@dskloet just push new commits to the same branch and it'll automatically associate them with this pull request! :) |
…ses. Fix the issue uncovered by this, which is that getFee might not be the actual fee, but only an estimate, if a change address is specified but there isn't enough to pay a fee and have change.
Thanks! I've pushed the fix. |
FYI: This pull requests addresses part of issue #1174. |
message: 'Fee is too large: {0}', | ||
}, { | ||
name: 'DifferentFeeError', | ||
message: 'Unspent value is different from specified fee: {0}', | ||
}, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could make these additional errors part of a general FeeError
:
if (err instanceof errors.Transaction.FeeError) {
//...
}
And if interested in a more specific exception:
if (err instanceof errors.Transaction.FeeError.TooSmall) {
//...
}
Is there a use case for disabling the check if fees are different? If so, the related Transaction serialization docs need to be updated with the additional serialization option. |
The check wasn't there before so I'm mostly just being defensive. Would you prefer I remove the ability to turn it off or add it to the docs? |
I realized that if it can be disabled, I also need to add a test that it can be disabled. |
@@ -85,8 +85,18 @@ module.exports = [{ | |||
name: 'InvalidSatoshis', | |||
message: 'Output satoshis are invalid', | |||
}, { | |||
name: 'FeeError', | |||
message: 'Fees are not correctly set {0}', | |||
name: 'Fee', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For backwards compatibility, we can keep this as FeeError
If the fee is specified and the actual fee would differ, I can't think of a use case to disable the check, as by not specifying an exact fee would be the means to do such. (I'll verify though). |
Makes sense. Let me know when you've verified it and I'll remove it. |
Yep, works as expected. |
… to the unspent value.
Don't ignore the fee when it's explicitly specified.
Make sure a specified transaction fee and outputs add up to the sum of the inputs.