mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
Prevent creation of on-chain invoices below the dust limit (#3082)
* 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>
This commit is contained in:
@@ -424,7 +424,7 @@ namespace BTCPayServer.Payments.PayJoin
|
||||
{
|
||||
var outputContribution = Money.Min(additionalFee, -due);
|
||||
outputContribution = Money.Min(outputContribution,
|
||||
newTx.Outputs[i].Value - newTx.Outputs[i].GetDustThreshold(minRelayTxFee));
|
||||
newTx.Outputs[i].Value - newTx.Outputs[i].GetDustThreshold());
|
||||
newTx.Outputs[i].Value -= outputContribution;
|
||||
additionalFee -= outputContribution;
|
||||
due += outputContribution;
|
||||
@@ -437,7 +437,7 @@ namespace BTCPayServer.Payments.PayJoin
|
||||
{
|
||||
var outputContribution = Money.Min(additionalFee, feeOutput.Value);
|
||||
outputContribution = Money.Min(outputContribution,
|
||||
feeOutput.Value - feeOutput.GetDustThreshold(minRelayTxFee));
|
||||
feeOutput.Value - feeOutput.GetDustThreshold());
|
||||
outputContribution = Money.Min(outputContribution, allowedSenderFeeContribution);
|
||||
feeOutput.Value -= outputContribution;
|
||||
additionalFee -= outputContribution;
|
||||
|
||||
Reference in New Issue
Block a user