always use mempool api

This commit is contained in:
Jesse de Wit
2023-05-12 09:22:11 +02:00
parent d0de038d45
commit cad6540f42
3 changed files with 28 additions and 31 deletions

View File

@@ -129,7 +129,6 @@ func newLspd(h *lntest.TestHarness, name string, nodeConfig *config.NodeConfig,
nodes,
fmt.Sprintf("DATABASE_URL=%s", postgresBackend.ConnectionString()),
fmt.Sprintf("LISTEN_ADDRESS=%s", grpcAddress),
"USE_MEMPOOL_FEE_ESTIMATION=true",
"MEMPOOL_API_BASE_URL=https://mempool.space/api/v1/",
"MEMPOOL_PRIORITY=economy",
}

12
main.go
View File

@@ -41,16 +41,17 @@ func main() {
log.Fatalf("need at least one node configured in NODES.")
}
var feeEstimator chain.FeeEstimator
var feeStrategy chain.FeeStrategy
useMempool := os.Getenv("USE_MEMPOOL_FEE_ESTIMATION") == "true"
if useMempool {
mempoolUrl := os.Getenv("MEMPOOL_API_BASE_URL")
feeEstimator, err = mempool.NewMempoolClient(mempoolUrl)
if mempoolUrl == "" {
log.Fatalf("No mempool url configured.")
}
feeEstimator, err := mempool.NewMempoolClient(mempoolUrl)
if err != nil {
log.Fatalf("failed to initialize mempool client: %v", err)
}
var feeStrategy chain.FeeStrategy
envFeeStrategy := os.Getenv("MEMPOOL_PRIORITY")
switch strings.ToLower(envFeeStrategy) {
case "minimum":
@@ -67,7 +68,6 @@ func main() {
feeStrategy = chain.FeeStrategyEconomy
}
log.Printf("using mempool api for fee estimation: %v, fee strategy: %v:%v", mempoolUrl, envFeeStrategy, feeStrategy)
}
databaseUrl := os.Getenv("DATABASE_URL")
pool, err := postgresql.PgConnect(databaseUrl)

View File

@@ -30,10 +30,8 @@ CHANNELMISMATCH_NOTIFICATION_TO='["Name1 <user1@domain.com>"]'
CHANNELMISMATCH_NOTIFICATION_CC='["Name2 <user2@domain.com>","Name3 <user3@domain.com>"]'
CHANNELMISMATCH_NOTIFICATION_FROM="Name4 <user4@domain.com>"
# By default lspd uses the fee estimation from the lightning node it is connected
# to for opening new channels. You can use mempool fee estimation instead by
# setting below variables.
USE_MEMPOOL_FEE_ESTIMATION=true
# lspd uses the fee estimation from mempool.space for opening new channels.
# Change below setting for you own mempool instance.
MEMPOOL_API_BASE_URL=https://mempool.space/api/v1/
# Priority to use for opening channels when using the mempool api.