@@ -929,6 +929,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
929929 }
930930
931931 mcCfg := & routing.MissionControlConfig {
932+ OnConfigUpdate : fn .Some (s .UpdateRoutingConfig ),
932933 Estimator : estimator ,
933934 MaxMcHistory : routingConfig .MaxMcHistory ,
934935 McFlushInterval : routingConfig .McFlushInterval ,
@@ -1699,6 +1700,35 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
16991700 return s , nil
17001701}
17011702
1703+ // UpdateRoutingConfig is a callback function to update the routing config
1704+ // values in the main cfg.
1705+ func (s * server ) UpdateRoutingConfig (cfg * routing.MissionControlConfig ) {
1706+ routerCfg := s .cfg .SubRPCServers .RouterRPC
1707+
1708+ switch c := cfg .Estimator .Config ().(type ) {
1709+ case routing.AprioriConfig :
1710+ routerCfg .ProbabilityEstimatorType =
1711+ routing .AprioriEstimatorName
1712+
1713+ targetCfg := routerCfg .AprioriConfig
1714+ targetCfg .PenaltyHalfLife = c .PenaltyHalfLife
1715+ targetCfg .Weight = c .AprioriWeight
1716+ targetCfg .CapacityFraction = c .CapacityFraction
1717+ targetCfg .HopProbability = c .AprioriHopProbability
1718+
1719+ case routing.BimodalConfig :
1720+ routerCfg .ProbabilityEstimatorType =
1721+ routing .BimodalEstimatorName
1722+
1723+ targetCfg := routerCfg .BimodalConfig
1724+ targetCfg .Scale = int64 (c .BimodalScaleMsat )
1725+ targetCfg .NodeWeight = c .BimodalNodeWeight
1726+ targetCfg .DecayTime = c .BimodalDecayTime
1727+ }
1728+
1729+ routerCfg .MaxMcHistory = cfg .MaxMcHistory
1730+ }
1731+
17021732// signAliasUpdate takes a ChannelUpdate and returns the signature. This is
17031733// used for option_scid_alias channels where the ChannelUpdate to be sent back
17041734// may differ from what is on disk.
0 commit comments