-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
mempool: introduce GetDustThreshold to export dust limit calculation #1742
mempool: introduce GetDustThreshold to export dust limit calculation #1742
Conversation
This commit modifies no behavior and would allow other projects to retrieve the dust limit for a particular output type before the amount of the output is known. This is particularly useful in the Lightning Network for channel negotiation.
Pull Request Test Coverage Report for Build 1136251577
💛 - Coveralls |
I just forced github to rerun the failing tests in case it was just a fluke. If the tests fail again, could you take a look at them before we review? |
@jcvernaleo the tests pass locally on my machine, looking at the CI the failures seem unrelated |
@@ -253,6 +246,20 @@ func IsDust(txOut *wire.TxOut, minRelayTxFee btcutil.Amount) bool { | |||
totalSize += 107 | |||
} | |||
|
|||
return 3 * int64(totalSize) |
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.
Why is the factor of 3
here retained? When in the original dust calculation, this value is used to ensure that the amount spent on fees to spend an output isn't greater than 1/3 of the relay 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.
Ah ok, we chatted offline and derived why this is in place.
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.
LGTM ⛳️
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.
OK
This commit modifies no behavior and would allow other projects to retrieve the dust limit for a particular output type before the amount of the output is known (so
IsDust
wouldn't be possible). This is particularly useful in the Lightning Network for channel negotiation. I did not include a unit test but I did locally check the following dust limits at the current 3000sat/kvb dust relay feerate: