mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 22:50:58 +02:00
multi: move exported items to lncfg
This commit is contained in:
59
config.go
59
config.go
@@ -35,10 +35,6 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// DefaultConfigFilename is the default configuration file name lnd
|
||||
// tries to load.
|
||||
DefaultConfigFilename = "lnd.conf"
|
||||
|
||||
defaultDataDirname = "data"
|
||||
defaultChainSubDirname = "chain"
|
||||
defaultGraphSubDirname = "graph"
|
||||
@@ -56,10 +52,6 @@ const (
|
||||
defaultPeerPort = 9735
|
||||
defaultRPCHost = "localhost"
|
||||
|
||||
// DefaultMaxPendingChannels is the default maximum number of incoming
|
||||
// pending channels permitted per peer.
|
||||
DefaultMaxPendingChannels = 1
|
||||
|
||||
defaultNoSeedBackup = false
|
||||
defaultPaymentsExpirationGracePeriod = time.Duration(0)
|
||||
defaultTrickleDelay = 90 * 1000
|
||||
@@ -78,51 +70,6 @@ const (
|
||||
defaultTorV2PrivateKeyFilename = "v2_onion_private_key"
|
||||
defaultTorV3PrivateKeyFilename = "v3_onion_private_key"
|
||||
|
||||
// DefaultIncomingBroadcastDelta defines the number of blocks before the
|
||||
// expiry of an incoming htlc at which we force close the channel. We
|
||||
// only go to chain if we also have the preimage to actually pull in the
|
||||
// htlc. BOLT #2 suggests 7 blocks. We use a few more for extra safety.
|
||||
// Within this window we need to get our sweep or 2nd level success tx
|
||||
// confirmed, because after that the remote party is also able to claim
|
||||
// the htlc using the timeout path.
|
||||
DefaultIncomingBroadcastDelta = 10
|
||||
|
||||
// defaultFinalCltvRejectDelta defines the number of blocks before the
|
||||
// expiry of an incoming exit hop htlc at which we cancel it back
|
||||
// immediately. It is an extra safety measure over the final cltv
|
||||
// requirement as it is defined in the invoice. It ensures that we
|
||||
// cancel back htlcs that, when held on to, may cause us to force close
|
||||
// the channel because we enter the incoming broadcast window. Bolt #11
|
||||
// suggests 9 blocks here. We use a few more for additional safety.
|
||||
//
|
||||
// There is still a small gap that remains between receiving the
|
||||
// RevokeAndAck and canceling back. If a new block arrives within that
|
||||
// window, we may still force close the channel. There is currently no
|
||||
// way to reject an UpdateAddHtlc of which we already know that it will
|
||||
// push us in the broadcast window.
|
||||
defaultFinalCltvRejectDelta = DefaultIncomingBroadcastDelta + 3
|
||||
|
||||
// DefaultOutgoingBroadcastDelta defines the number of blocks before the
|
||||
// expiry of an outgoing htlc at which we force close the channel. We
|
||||
// are not in a hurry to force close, because there is nothing to claim
|
||||
// for us. We do need to time the htlc out, because there may be an
|
||||
// incoming htlc that will time out too (albeit later). Bolt #2 suggests
|
||||
// a value of -1 here, but we allow one block less to prevent potential
|
||||
// confusion around the negative value. It means we force close the
|
||||
// channel at exactly the htlc expiry height.
|
||||
DefaultOutgoingBroadcastDelta = 0
|
||||
|
||||
// defaultOutgoingCltvRejectDelta defines the number of blocks before
|
||||
// the expiry of an outgoing htlc at which we don't want to offer it to
|
||||
// the next peer anymore. If that happens, we cancel back the incoming
|
||||
// htlc. This is to prevent the situation where we have an outstanding
|
||||
// htlc that brings or will soon bring us inside the outgoing broadcast
|
||||
// window and trigger us to force close the channel. Bolt #2 suggests a
|
||||
// value of 0. We pad it a bit, to prevent a slow round trip to the next
|
||||
// peer and a block arriving during that round trip to trigger force
|
||||
// closure.
|
||||
defaultOutgoingCltvRejectDelta = DefaultOutgoingBroadcastDelta + 3
|
||||
|
||||
// minTimeLockDelta is the minimum timelock we require for incoming
|
||||
// HTLCs on our channels.
|
||||
minTimeLockDelta = 4
|
||||
@@ -146,7 +93,7 @@ var (
|
||||
|
||||
// DefaultConfigFile is the default full path of lnd's configuration
|
||||
// file.
|
||||
DefaultConfigFile = filepath.Join(DefaultLndDir, DefaultConfigFilename)
|
||||
DefaultConfigFile = filepath.Join(DefaultLndDir, lncfg.DefaultConfigFilename)
|
||||
|
||||
defaultDataDir = filepath.Join(DefaultLndDir, defaultDataDirname)
|
||||
defaultLogDir = filepath.Join(DefaultLndDir, defaultLogDirname)
|
||||
@@ -352,7 +299,7 @@ func DefaultConfig() Config {
|
||||
EstimateMode: defaultBitcoindEstimateMode,
|
||||
},
|
||||
UnsafeDisconnect: true,
|
||||
MaxPendingChannels: DefaultMaxPendingChannels,
|
||||
MaxPendingChannels: lncfg.DefaultMaxPendingChannels,
|
||||
NoSeedBackup: defaultNoSeedBackup,
|
||||
MinBackoff: defaultMinBackoff,
|
||||
MaxBackoff: defaultMaxBackoff,
|
||||
@@ -440,7 +387,7 @@ func LoadConfig() (*Config, error) {
|
||||
if configFileDir != DefaultLndDir {
|
||||
if configFilePath == DefaultConfigFile {
|
||||
configFilePath = filepath.Join(
|
||||
configFileDir, DefaultConfigFilename,
|
||||
configFileDir, lncfg.DefaultConfigFilename,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user