Skip to content

Commit

Permalink
Merge pull request #1087 from breez/inbound-liquidity-changes
Browse files Browse the repository at this point in the history
fix notifications code to compile with the new node state properties
  • Loading branch information
roeierez committed Sep 17, 2024
2 parents 7865ef9 + f2fc642 commit b9e7fb5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ class LnurlPayInfoJob(
}
// Calculate the maximum sendable amount (in millisatoshis)
val maxSendable = maxOf(
nodeInfo.inboundLiquidityMsats,
nodeInfo.maxReceivableSinglePaymentAmountMsat,
maxReceivableMsatFeeLimit,
)
// Get the minimum sendable amount (in millisatoshis), can not be less than 1 or more than maxSendable
val minSendable: ULong =
if (nodeInfo.inboundLiquidityMsats < 1000UL) ofp.minMsat else 1000UL
if (nodeInfo.maxReceivableSinglePaymentAmountMsat < 1000UL) ofp.minMsat else 1000UL
if (minSendable > maxSendable) {
throw InvalidMinSendableException("Minimum sendable amount can't be greater than maximum sendable amount.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ class LnurlPayInfoTask : LnurlPayTask {
UInt64(Double(feeLimitMsat) / proportionalPercent)
) : nodeInfo.maxReceivableMsat
// Calculate the maximum sendable amount (in millisatoshis)
let maxSendable = max(nodeInfo.inboundLiquidityMsats, maxReceivableMsatFeeLimit)
let maxSendable = max(nodeInfo.maxReceivableSinglePaymentAmountMsat, maxReceivableMsatFeeLimit)
// Get the minimum sendable amount (in millisatoshis), can not be less than 1 or more than maxSendable
let minSendable: UInt64 = nodeInfo.inboundLiquidityMsats < UInt64(1000) ? ofp.minMsat : UInt64(1000)
let minSendable: UInt64 = nodeInfo.maxReceivableSinglePaymentAmountMsat < UInt64(1000) ? ofp.minMsat : UInt64(1000)
if minSendable > maxSendable {
throw InvalidMinSendable.largerThanMaxSendable
}
Expand Down

0 comments on commit b9e7fb5

Please sign in to comment.