Skip to content
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

Merged
merged 6 commits into from Nov 15, 2021

Conversation

satwo
Copy link
Contributor

@satwo satwo commented Nov 10, 2021

Fixes #3071.

satwo and others added 2 commits November 10, 2021 11:15
Co-authored-by: Nicolas Dorier <nicolas.dorier@gmail.com>
@satwo
Copy link
Contributor Author

satwo commented Nov 10, 2021

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)
Copy link
Contributor Author

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 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems ok

Copy link
Contributor Author

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.

@NicolasDorier
Copy link
Member

Fixed the test, also extended the test to actually test the dust limit.

@NicolasDorier NicolasDorier merged commit cbcd59c into btcpayserver:master Nov 15, 2021
NicolasDorier added a commit that referenced this pull request Nov 15, 2021
* 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>
@satwo satwo deleted the prevent-dust-onchain-payment branch November 16, 2021 14:14
charleyforey pushed a commit to zeus-pay/btcpayserver that referenced this pull request Jan 27, 2022
…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>
zeus-pay pushed a commit to zeus-pay/btcpayserver that referenced this pull request Feb 3, 2022
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prevent the creation of below dust limit on-chain payment method for small amount invoices
2 participants