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
Prevent creation of on-chain invoices below the dust limit #3082
Prevent creation of on-chain invoices below the dust limit #3082
Conversation
Co-authored-by: Nicolas Dorier <nicolas.dorier@gmail.com>
Will fix the tests. |
0.000000012 BTC (whether rounded or not) is below the dust threshold, causing this test to fail.
Don't apply dust threshold conditional for topup invoices.
@@ -196,7 +196,7 @@ private string GetPaymentMethodName(BTCPayNetworkBase network) | |||
var dust = txOut.GetDustThreshold(); | |||
var amount = paymentMethod.Calculate().Due; | |||
|
|||
if (amount < dust) | |||
if (amount < dust && paymentMethod.ParentEntity.Type != InvoiceType.TopUp) |
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.
@NicolasDorier Would it be better to use here
&& paymentMethod.ParentEntity.Type == InvoiceType.Standard
?
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.
seems ok
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.
Cool, wasn't sure if there are more non-standard invoice types in the pipeline.
471fef4
to
9e69393
Compare
Fixed the test, also extended the test to actually test the dust limit. |
* Prevent creation of on-chain invoices below the dust limit Fixes #3071. * Apply suggestions from code review Co-authored-by: Nicolas Dorier <nicolas.dorier@gmail.com> * small fix * Fix selenium test 0.000000012 BTC (whether rounded or not) is below the dust threshold, causing this test to fail. * fix CanCreateTopupInvoices test Don't apply dust threshold conditional for topup invoices. * Fix test, and minor changes Co-authored-by: Nicolas Dorier <nicolas.dorier@gmail.com>
…ver#3082) * Prevent creation of on-chain invoices below the dust limit Fixes btcpayserver#3071. * Apply suggestions from code review Co-authored-by: Nicolas Dorier <nicolas.dorier@gmail.com> * small fix * Fix selenium test 0.000000012 BTC (whether rounded or not) is below the dust threshold, causing this test to fail. * fix CanCreateTopupInvoices test Don't apply dust threshold conditional for topup invoices. * Fix test, and minor changes Co-authored-by: Nicolas Dorier <nicolas.dorier@gmail.com>
…ver#3082) * Prevent creation of on-chain invoices below the dust limit Fixes btcpayserver#3071. * Apply suggestions from code review Co-authored-by: Nicolas Dorier <nicolas.dorier@gmail.com> * small fix * Fix selenium test 0.000000012 BTC (whether rounded or not) is below the dust threshold, causing this test to fail. * fix CanCreateTopupInvoices test Don't apply dust threshold conditional for topup invoices. * Fix test, and minor changes Co-authored-by: Nicolas Dorier <nicolas.dorier@gmail.com>
Fixes #3071.