mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-20 13:34:32 +01:00
lnd: compute funding params for ltc if active
This commit is contained in:
parent
5f7a62913f
commit
821ec9e550
1 changed files with 14 additions and 3 deletions
17
lnd.go
17
lnd.go
|
@ -238,6 +238,17 @@ func lndMain() error {
|
|||
primaryChain := registeredChains.PrimaryChain()
|
||||
registeredChains.RegisterChain(primaryChain, activeChainControl)
|
||||
|
||||
// Select the configuration and furnding parameters for Bitcoin or
|
||||
// Litecoin, depending on the primary registered chain.
|
||||
chainCfg := cfg.Bitcoin
|
||||
minRemoteDelay := minBtcRemoteDelay
|
||||
maxRemoteDelay := maxBtcRemoteDelay
|
||||
if primaryChain == litecoinChain {
|
||||
chainCfg = cfg.Litecoin
|
||||
minRemoteDelay = minLtcRemoteDelay
|
||||
maxRemoteDelay = maxLtcRemoteDelay
|
||||
}
|
||||
|
||||
// TODO(roasbeef): add rotation
|
||||
idPrivKey, err := activeChainControl.wallet.DerivePrivKey(keychain.KeyDescriptor{
|
||||
KeyLocator: keychain.KeyLocator{
|
||||
|
@ -340,7 +351,7 @@ func lndMain() error {
|
|||
// In case the user has explicitly specified
|
||||
// a default value for the number of
|
||||
// confirmations, we use it.
|
||||
defaultConf := uint16(cfg.Bitcoin.DefaultNumChanConfs)
|
||||
defaultConf := uint16(chainCfg.DefaultNumChanConfs)
|
||||
if defaultConf != 0 {
|
||||
return defaultConf
|
||||
}
|
||||
|
@ -373,13 +384,13 @@ func lndMain() error {
|
|||
// In case the user has explicitly specified
|
||||
// a default value for the remote delay, we
|
||||
// use it.
|
||||
defaultDelay := uint16(cfg.Bitcoin.DefaultRemoteDelay)
|
||||
defaultDelay := uint16(chainCfg.DefaultRemoteDelay)
|
||||
if defaultDelay > 0 {
|
||||
return defaultDelay
|
||||
}
|
||||
|
||||
// If not we scale according to channel size.
|
||||
delay := uint16(maxRemoteDelay *
|
||||
delay := uint16(btcutil.Amount(maxRemoteDelay) *
|
||||
chanAmt / maxFundingAmount)
|
||||
if delay < minRemoteDelay {
|
||||
delay = minRemoteDelay
|
||||
|
|
Loading…
Add table
Reference in a new issue