Replace --max-absolute-fee
by --max-mining-fee
(#32)
It makes much more sense to consider only the mining fee, for the absolute fee check, as it is volatile and amount-independent. The service fee is in % and predictable. The default value is equivalent as before (1% of the default `auto-liquidity`, given that the previous value of 2% included the 1% liquidity service fee). Previous option is deprecated and explicitly rejected.
This commit is contained in:
parent
75247e4de2
commit
5e1ab0d5d9
@ -1,6 +1,6 @@
|
|||||||
object Versions {
|
object Versions {
|
||||||
val kotlin = "1.9.23"
|
val kotlin = "1.9.23"
|
||||||
val lightningKmp = "1.6.2-FEECREDIT-5"
|
val lightningKmp = "1.6.2-FEECREDIT-6"
|
||||||
val sqlDelight = "2.0.1"
|
val sqlDelight = "2.0.1"
|
||||||
val okio = "3.8.0"
|
val okio = "3.8.0"
|
||||||
val clikt = "4.2.2"
|
val clikt = "4.2.2"
|
||||||
|
@ -120,13 +120,14 @@ class Phoenixd : CliktCommand() {
|
|||||||
"5m" to 5_000_000.sat,
|
"5m" to 5_000_000.sat,
|
||||||
"10m" to 10_000_000.sat,
|
"10m" to 10_000_000.sat,
|
||||||
).default(2_000_000.sat, "2m")
|
).default(2_000_000.sat, "2m")
|
||||||
val maxAbsoluteFee by option("--max-absolute-fee", help = "Max absolute fee for on-chain operations. Includes mining fee and service fee for auto-liquidity.")
|
val maxAbsoluteFee by option("--max-absolute-fee", hidden = true).deprecated("--max-absolute-fee is deprecated, use --max-mining-fee instead", error = true)
|
||||||
|
val maxMiningFee by option("--max-mining-fee", help = "Max mining fee for on-chain operations, in satoshis")
|
||||||
.int().convert { it.sat }
|
.int().convert { it.sat }
|
||||||
.restrictTo(5_000.sat..100_000.sat)
|
.restrictTo(5_000.sat..200_000.sat)
|
||||||
.defaultLazy("2% of auto-liquidity amount") {
|
.defaultLazy("1% of auto-liquidity amount") {
|
||||||
autoLiquidity * 2 / 100
|
autoLiquidity * 1 / 100
|
||||||
}
|
}
|
||||||
val maxFeeCredit by option("--max-fee-credit", help = "Max fee credit, if reached payments will be rejected.").choice(
|
val maxFeeCredit by option("--max-fee-credit", help = "Max fee credit, if reached payments will be rejected").choice(
|
||||||
"off" to 0.sat,
|
"off" to 0.sat,
|
||||||
"50k" to 50_000.sat,
|
"50k" to 50_000.sat,
|
||||||
"100k" to 100_000.sat,
|
"100k" to 100_000.sat,
|
||||||
@ -219,9 +220,9 @@ class Phoenixd : CliktCommand() {
|
|||||||
)
|
)
|
||||||
val lsp = LSP.from(chain)
|
val lsp = LSP.from(chain)
|
||||||
val liquidityPolicy = LiquidityPolicy.Auto(
|
val liquidityPolicy = LiquidityPolicy.Auto(
|
||||||
maxAbsoluteFee = liquidityOptions.maxAbsoluteFee,
|
maxMiningFee = liquidityOptions.maxMiningFee,
|
||||||
maxRelativeFeeBasisPoints = liquidityOptions.maxRelativeFeeBasisPoints,
|
maxRelativeFeeBasisPoints = liquidityOptions.maxRelativeFeeBasisPoints,
|
||||||
skipAbsoluteFeeCheck = false,
|
skipMiningFeeCheck = false,
|
||||||
maxAllowedCredit = liquidityOptions.maxFeeCredit
|
maxAllowedCredit = liquidityOptions.maxFeeCredit
|
||||||
)
|
)
|
||||||
val keyManager = LocalKeyManager(seed.seed, chain, lsp.swapInXpub)
|
val keyManager = LocalKeyManager(seed.seed, chain, lsp.swapInXpub)
|
||||||
@ -309,10 +310,10 @@ class Phoenixd : CliktCommand() {
|
|||||||
.collect {
|
.collect {
|
||||||
when (val reason = it.reason) {
|
when (val reason = it.reason) {
|
||||||
is LiquidityEvents.Decision.Rejected.Reason.OverMaxCredit -> {
|
is LiquidityEvents.Decision.Rejected.Reason.OverMaxCredit -> {
|
||||||
consoleLog(yellow("lightning payment rejected (amount=${it.amount.truncateToSatoshi()}): over max fee credit=${reason.maxAllowedCredit}"))
|
consoleLog(yellow("lightning payment rejected (amount=${it.amount.truncateToSatoshi()}): over max fee credit (max=${reason.maxAllowedCredit})"))
|
||||||
}
|
}
|
||||||
is LiquidityEvents.Decision.Rejected.Reason.TooExpensive.OverAbsoluteFee -> {
|
is LiquidityEvents.Decision.Rejected.Reason.TooExpensive.OverMaxMiningFee -> {
|
||||||
consoleLog(yellow("lightning payment rejected (amount=${it.amount.truncateToSatoshi()}): fee=${it.fee.truncateToSatoshi()} > maxFee=${reason.maxAbsoluteFee}"))
|
consoleLog(yellow("lightning payment rejected (amount=${it.amount.truncateToSatoshi()}): over max mining fee (max=${reason.maxMiningFee})"))
|
||||||
}
|
}
|
||||||
is LiquidityEvents.Decision.Rejected.Reason.TooExpensive.OverRelativeFee -> {
|
is LiquidityEvents.Decision.Rejected.Reason.TooExpensive.OverRelativeFee -> {
|
||||||
consoleLog(yellow("lightning payment rejected (amount=${it.amount.truncateToSatoshi()}): fee=${it.fee.truncateToSatoshi()} more than ${reason.maxRelativeFeeBasisPoints.toDouble() / 100}% of amount"))
|
consoleLog(yellow("lightning payment rejected (amount=${it.amount.truncateToSatoshi()}): fee=${it.fee.truncateToSatoshi()} more than ${reason.maxRelativeFeeBasisPoints.toDouble() / 100}% of amount"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user