• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lightningnetwork / lnd / 14358372723

09 Apr 2025 01:26PM UTC coverage: 56.696% (-12.3%) from 69.037%
14358372723

Pull #9696

github

web-flow
Merge e2837e400 into 867d27d68
Pull Request #9696: Add `development_guidelines.md` for both human and machine

107055 of 188823 relevant lines covered (56.7%)

22721.56 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

55.1
/lnrpc/routerrpc/config.go
1
package routerrpc
2

3
import (
4
        "github.com/lightningnetwork/lnd/aliasmgr"
5
        "github.com/lightningnetwork/lnd/macaroons"
6
        "github.com/lightningnetwork/lnd/routing"
7
)
8

9
// Config is the main configuration file for the router RPC server. It contains
10
// all the items required for the router RPC server to carry out its duties.
11
// The fields with struct tags are meant to be parsed as normal configuration
12
// options, while if able to be populated, the latter fields MUST also be
13
// specified.
14
//
15
//nolint:ll
16
type Config struct {
17
        RoutingConfig
18

19
        // UseStatusInitiated is a boolean that indicates whether the router
20
        // should use the new status code `Payment_INITIATED`.
21
        //
22
        // TODO(yy): remove this config after the new status code is fully
23
        // deployed to the network(v0.20.0).
24
        UseStatusInitiated bool `long:"usestatusinitiated" description:"If true, the router will send Payment_INITIATED for new payments, otherwise Payment_In_FLIGHT will be sent for compatibility concerns."`
25

26
        // RouterMacPath is the path for the router macaroon. If unspecified
27
        // then we assume that the macaroon will be found under the network
28
        // directory, named DefaultRouterMacFilename.
29
        RouterMacPath string `long:"routermacaroonpath" description:"Path to the router macaroon"`
30

31
        // NetworkDir is the main network directory wherein the router rpc
32
        // server will find the macaroon named DefaultRouterMacFilename.
33
        NetworkDir string
34

35
        // MacService is the main macaroon service that we'll use to handle
36
        // authentication for the Router rpc server.
37
        MacService *macaroons.Service
38

39
        // Router is the main channel router instance that backs this RPC
40
        // server.
41
        //
42
        // TODO(roasbeef): make into pkg lvl interface?
43
        //
44
        // TODO(roasbeef): assumes router handles saving payment state
45
        Router *routing.ChannelRouter
46

47
        // RouterBackend contains shared logic between this sub server and the
48
        // main rpc server.
49
        RouterBackend *RouterBackend
50

51
        // AliasMgr is the alias manager instance that is used to handle all the
52
        // SCID alias related information for channels.
53
        AliasMgr *aliasmgr.Manager
54
}
55

56
// DefaultConfig defines the config defaults.
57
func DefaultConfig() *Config {
1✔
58
        defaultRoutingConfig := RoutingConfig{
1✔
59
                ProbabilityEstimatorType: routing.DefaultEstimator,
1✔
60
                MinRouteProbability:      routing.DefaultMinRouteProbability,
1✔
61

1✔
62
                AttemptCost:     routing.DefaultAttemptCost.ToSatoshis(),
1✔
63
                AttemptCostPPM:  routing.DefaultAttemptCostPPM,
1✔
64
                MaxMcHistory:    routing.DefaultMaxMcHistory,
1✔
65
                McFlushInterval: routing.DefaultMcFlushInterval,
1✔
66
                AprioriConfig: &AprioriConfig{
1✔
67
                        HopProbability:   routing.DefaultAprioriHopProbability,
1✔
68
                        Weight:           routing.DefaultAprioriWeight,
1✔
69
                        PenaltyHalfLife:  routing.DefaultPenaltyHalfLife,
1✔
70
                        CapacityFraction: routing.DefaultCapacityFraction,
1✔
71
                },
1✔
72
                BimodalConfig: &BimodalConfig{
1✔
73
                        Scale:      int64(routing.DefaultBimodalScaleMsat),
1✔
74
                        NodeWeight: routing.DefaultBimodalNodeWeight,
1✔
75
                        DecayTime:  routing.DefaultBimodalDecayTime,
1✔
76
                },
1✔
77
                FeeEstimationTimeout: routing.DefaultFeeEstimationTimeout,
1✔
78
        }
1✔
79

1✔
80
        return &Config{
1✔
81
                RoutingConfig: defaultRoutingConfig,
1✔
82
        }
1✔
83
}
1✔
84

85
// GetRoutingConfig returns the routing config based on this sub server config.
86
func GetRoutingConfig(cfg *Config) *RoutingConfig {
×
87
        return &RoutingConfig{
×
88
                ProbabilityEstimatorType: cfg.ProbabilityEstimatorType,
×
89
                MinRouteProbability:      cfg.MinRouteProbability,
×
90
                AttemptCost:              cfg.AttemptCost,
×
91
                AttemptCostPPM:           cfg.AttemptCostPPM,
×
92
                MaxMcHistory:             cfg.MaxMcHistory,
×
93
                McFlushInterval:          cfg.McFlushInterval,
×
94
                AprioriConfig: &AprioriConfig{
×
95
                        HopProbability:   cfg.AprioriConfig.HopProbability,
×
96
                        Weight:           cfg.AprioriConfig.Weight,
×
97
                        PenaltyHalfLife:  cfg.AprioriConfig.PenaltyHalfLife,
×
98
                        CapacityFraction: cfg.AprioriConfig.CapacityFraction,
×
99
                },
×
100
                BimodalConfig: &BimodalConfig{
×
101
                        Scale:      cfg.BimodalConfig.Scale,
×
102
                        NodeWeight: cfg.BimodalConfig.NodeWeight,
×
103
                        DecayTime:  cfg.BimodalConfig.DecayTime,
×
104
                },
×
105
                FeeEstimationTimeout: cfg.FeeEstimationTimeout,
×
106
        }
×
107
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc