Skip to content

Commit

Permalink
fix notifications code to compile with the new node state properties
Browse files Browse the repository at this point in the history
  • Loading branch information
roeierez committed Sep 17, 2024
1 parent 7865ef9 commit f2fc642
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 f2fc642

Please sign in to comment.