mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 06:21:40 +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()
|
primaryChain := registeredChains.PrimaryChain()
|
||||||
registeredChains.RegisterChain(primaryChain, activeChainControl)
|
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
|
// TODO(roasbeef): add rotation
|
||||||
idPrivKey, err := activeChainControl.wallet.DerivePrivKey(keychain.KeyDescriptor{
|
idPrivKey, err := activeChainControl.wallet.DerivePrivKey(keychain.KeyDescriptor{
|
||||||
KeyLocator: keychain.KeyLocator{
|
KeyLocator: keychain.KeyLocator{
|
||||||
|
@ -340,7 +351,7 @@ func lndMain() error {
|
||||||
// In case the user has explicitly specified
|
// In case the user has explicitly specified
|
||||||
// a default value for the number of
|
// a default value for the number of
|
||||||
// confirmations, we use it.
|
// confirmations, we use it.
|
||||||
defaultConf := uint16(cfg.Bitcoin.DefaultNumChanConfs)
|
defaultConf := uint16(chainCfg.DefaultNumChanConfs)
|
||||||
if defaultConf != 0 {
|
if defaultConf != 0 {
|
||||||
return defaultConf
|
return defaultConf
|
||||||
}
|
}
|
||||||
|
@ -373,13 +384,13 @@ func lndMain() error {
|
||||||
// In case the user has explicitly specified
|
// In case the user has explicitly specified
|
||||||
// a default value for the remote delay, we
|
// a default value for the remote delay, we
|
||||||
// use it.
|
// use it.
|
||||||
defaultDelay := uint16(cfg.Bitcoin.DefaultRemoteDelay)
|
defaultDelay := uint16(chainCfg.DefaultRemoteDelay)
|
||||||
if defaultDelay > 0 {
|
if defaultDelay > 0 {
|
||||||
return defaultDelay
|
return defaultDelay
|
||||||
}
|
}
|
||||||
|
|
||||||
// If not we scale according to channel size.
|
// If not we scale according to channel size.
|
||||||
delay := uint16(maxRemoteDelay *
|
delay := uint16(btcutil.Amount(maxRemoteDelay) *
|
||||||
chanAmt / maxFundingAmount)
|
chanAmt / maxFundingAmount)
|
||||||
if delay < minRemoteDelay {
|
if delay < minRemoteDelay {
|
||||||
delay = minRemoteDelay
|
delay = minRemoteDelay
|
||||||
|
|
Loading…
Add table
Reference in a new issue