mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-05-28 20:49:52 +02:00
chainregistry: use forwarding policy rules from config
This commit removes the definitions of defaultBitcoinForwardingPolicy and defaultLitecoinForwardingPolicy from the the chainregistry, and instead creates a routingPolicy from the values found in the config.
This commit is contained in:
parent
f1c6d40db8
commit
10bd46ac72
@ -18,7 +18,6 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/htlcswitch"
|
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet/btcwallet"
|
"github.com/lightningnetwork/lnd/lnwallet/btcwallet"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
|
||||||
"github.com/lightningnetwork/lnd/routing/chainview"
|
"github.com/lightningnetwork/lnd/routing/chainview"
|
||||||
"github.com/roasbeef/btcd/chaincfg/chainhash"
|
"github.com/roasbeef/btcd/chaincfg/chainhash"
|
||||||
"github.com/roasbeef/btcd/rpcclient"
|
"github.com/roasbeef/btcd/rpcclient"
|
||||||
@ -27,28 +26,11 @@ import (
|
|||||||
"github.com/roasbeef/btcwallet/walletdb"
|
"github.com/roasbeef/btcwallet/walletdb"
|
||||||
)
|
)
|
||||||
|
|
||||||
// defaultBitcoinForwardingPolicy is the default forwarding policy used for
|
|
||||||
// Bitcoin channels.
|
|
||||||
var defaultBitcoinForwardingPolicy = htlcswitch.ForwardingPolicy{
|
|
||||||
MinHTLC: lnwire.NewMSatFromSatoshis(1),
|
|
||||||
BaseFee: lnwire.NewMSatFromSatoshis(1),
|
|
||||||
FeeRate: 1,
|
|
||||||
TimeLockDelta: 144,
|
|
||||||
}
|
|
||||||
|
|
||||||
// defaultLitecoinForwardingPolicy is the default forwarding policy used for
|
|
||||||
// Litecoin channels.
|
|
||||||
var defaultLitecoinForwardingPolicy = htlcswitch.ForwardingPolicy{
|
|
||||||
MinHTLC: lnwire.NewMSatFromSatoshis(1),
|
|
||||||
BaseFee: 1,
|
|
||||||
FeeRate: 1,
|
|
||||||
TimeLockDelta: 576,
|
|
||||||
}
|
|
||||||
|
|
||||||
// defaultChannelConstraints is the default set of channel constraints that are
|
// defaultChannelConstraints is the default set of channel constraints that are
|
||||||
// meant to be used when initially funding a channel.
|
// meant to be used when initially funding a channel.
|
||||||
//
|
//
|
||||||
// TODO(roasbeef): have one for both chains
|
// TODO(roasbeef): have one for both chains
|
||||||
|
// TODO(halseth): make configurable at startup?
|
||||||
var defaultChannelConstraints = channeldb.ChannelConstraints{
|
var defaultChannelConstraints = channeldb.ChannelConstraints{
|
||||||
DustLimit: lnwallet.DefaultDustLimit(),
|
DustLimit: lnwallet.DefaultDustLimit(),
|
||||||
MaxAcceptedHtlcs: lnwallet.MaxHTLCNumber / 2,
|
MaxAcceptedHtlcs: lnwallet.MaxHTLCNumber / 2,
|
||||||
@ -119,12 +101,22 @@ func newChainControlFromConfig(cfg *config, chanDB *channeldb.DB,
|
|||||||
|
|
||||||
switch registeredChains.PrimaryChain() {
|
switch registeredChains.PrimaryChain() {
|
||||||
case bitcoinChain:
|
case bitcoinChain:
|
||||||
cc.routingPolicy = defaultBitcoinForwardingPolicy
|
cc.routingPolicy = htlcswitch.ForwardingPolicy{
|
||||||
|
MinHTLC: cfg.Bitcoin.MinHTLC,
|
||||||
|
BaseFee: cfg.Bitcoin.BaseFee,
|
||||||
|
FeeRate: cfg.Bitcoin.FeeRate,
|
||||||
|
TimeLockDelta: cfg.Bitcoin.TimeLockDelta,
|
||||||
|
}
|
||||||
cc.feeEstimator = lnwallet.StaticFeeEstimator{
|
cc.feeEstimator = lnwallet.StaticFeeEstimator{
|
||||||
FeeRate: 50,
|
FeeRate: 50,
|
||||||
}
|
}
|
||||||
case litecoinChain:
|
case litecoinChain:
|
||||||
cc.routingPolicy = defaultLitecoinForwardingPolicy
|
cc.routingPolicy = htlcswitch.ForwardingPolicy{
|
||||||
|
MinHTLC: cfg.Litecoin.MinHTLC,
|
||||||
|
BaseFee: cfg.Litecoin.BaseFee,
|
||||||
|
FeeRate: cfg.Litecoin.FeeRate,
|
||||||
|
TimeLockDelta: cfg.Litecoin.TimeLockDelta,
|
||||||
|
}
|
||||||
cc.feeEstimator = lnwallet.StaticFeeEstimator{
|
cc.feeEstimator = lnwallet.StaticFeeEstimator{
|
||||||
FeeRate: 100,
|
FeeRate: 100,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user