mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-01-17 13:04:21 +01:00
Fix "Do not propose lightning payment if value of the invoice is above..." take care of the GAP edge case where OnChainMinValue > LightningMaxValue
This commit is contained in:
@@ -163,16 +163,29 @@ namespace BTCPayServer.Payments.Lightning
|
||||
limitValue = storeBlob.LightningMaxValue;
|
||||
errorMessage = "The amount of the invoice is too high to be paid with lightning";
|
||||
}
|
||||
else if (storeBlob.LightningMaxValue == null &&
|
||||
storeBlob.OnChainMinValue != null)
|
||||
{
|
||||
//TODO: Case of LightningMaxValue not set and OnChainMinValue set
|
||||
}
|
||||
else if (storeBlob.LightningMaxValue != null &&
|
||||
storeBlob.OnChainMinValue != null)
|
||||
{
|
||||
//TODO: Case of LightningMaxValue set and OnChainMinValue set
|
||||
}
|
||||
if (storeBlob.LightningMaxValue.Currency == storeBlob.OnChainMinValue.Currency &&
|
||||
storeBlob.LightningMaxValue.Value >= storeBlob.OnChainMinValue.Value)
|
||||
{
|
||||
//Case where both fields are set but LightningMaxValue is greater
|
||||
// --> then use LightningMaxValue as limit
|
||||
compare = (value, limit) => value >= limit;
|
||||
limitValue = storeBlob.LightningMaxValue;
|
||||
errorMessage = "The amount of the invoice is too high to be paid with lightning";
|
||||
}
|
||||
else if (storeBlob.LightningMaxValue.Currency == storeBlob.OnChainMinValue.Currency &&
|
||||
storeBlob.LightningMaxValue.Value < storeBlob.OnChainMinValue.Value)
|
||||
{
|
||||
//Case where both fields are set but OnChainMinValue is greater
|
||||
// --> then use OnChainMinValue as limit
|
||||
// (Otherwise a gap of price value with no payment method is possible)
|
||||
compare = (value, limit) => value >= limit;
|
||||
limitValue = storeBlob.OnChainMinValue;
|
||||
errorMessage = "The amount of the invoice is too high to be paid with lightning";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user