lightningnetwork/lnd

[bug]: `lncli getdebuginfo` not showing the current state of config

feelancer21 opened this issue ยท 8 comments

I used lncli debuglevel to change the debuglevel and lncli setmccfg to change the estimator. In both cases the config under lncli getdebuginfo has not changed. It seems that only the config at the start time is displayed there and not the current state.

Yeah, those two RPCs don't seem to bubble up their changes to the main cfg struct of the RPC server, which should be quite trivial to fix.

Hello ... I've just reproduced the bug ... Can I work on it?

Yeah, those two RPCs don't seem to bubble up their changes to the main cfg struct of the RPC server, which should be quite trivial to fix.

The DebugLevel on main cfg can be updated at the end of the function 'DebugLevel'

On the other hand it seems that I can not access cfg from the function [setCfg] (https://github.com/lightningnetwork/lnd/blob/8adec8692ad2b8e1d1a4023c56ccc6db8ddcce76/cmd/commands/cmd_mission_control.go#L118)

Any Tip? Am I missing something?

You're looking in the wrong place, what you linked to is the Command Line Interface. You'll want to take a look at the server implementation here:

func (s *Server) SetMissionControlConfig(ctx context.Context,

That then seems to call into this:
func (m *MissionControl) SetConfig(cfg *MissionControlConfig) error {

Both places don't have access to the main cfg, so it's probably a bit more involved to get things working here.
My suggestion would be to pass in a callback into MissionControl that allows the root level config to be updated. That callback would then be set and implemented somewhere here:

lnd/server.go

Line 927 in eaa8592

mcCfg := &routing.MissionControlConfig{
where you have s.cfg available.

ssionControl that allows the root level config to be updated. That callback would then be set and implemented somewhere here:

DebugLevel was easy as expected ... done and tested but I'm struggling to understand how to implement, pass and call the callback function... it's a new concept to me ...

DebugLevel was easy as expected ... done and tested but I'm struggling to understand how to implement, pass and call the callback function... it's a new concept to me ...

I think a good example is UpdateForwardingPolicies which is part of the switch. The channel manager updating the policies has only access to a function

type Manager struct {
// UpdateForwardingPolicies is used by the manager to update active
// links with a new policy.
UpdateForwardingPolicies func(
chanPolicies map[wire.OutPoint]models.ForwardingPolicy)

The function is passed here to the manager.

lnd/server.go

Lines 1045 to 1050 in 68494fd

s.localChanMgr = &localchans.Manager{
ForAllOutgoingChannels: s.chanRouter.ForAllOutgoingChannels,
PropagateChanPolicyUpdate: s.authGossiper.PropagateChanPolicyUpdate,
UpdateForwardingPolicies: s.htlcSwitch.UpdateForwardingPolicies,
FetchChannel: s.chanStateDB.FetchChannel,
}

DebugLevel was easy as expected ... done and tested but I'm struggling to understand how to implement, pass and call the callback function... it's a new concept to me ...

I think a good example is UpdateForwardingPolicies which is part of the switch. The channel manager updating the policies has only access to a function

type Manager struct {
// UpdateForwardingPolicies is used by the manager to update active
// links with a new policy.
UpdateForwardingPolicies func(
chanPolicies map[wire.OutPoint]models.ForwardingPolicy)

The function is passed here to the manager.

lnd/server.go

Lines 1045 to 1050 in 68494fd

s.localChanMgr = &localchans.Manager{
ForAllOutgoingChannels: s.chanRouter.ForAllOutgoingChannels,
PropagateChanPolicyUpdate: s.authGossiper.PropagateChanPolicyUpdate,
UpdateForwardingPolicies: s.htlcSwitch.UpdateForwardingPolicies,
FetchChannel: s.chanStateDB.FetchChannel,
}

Thank you ... I'll take a look!

Hello @guggero and @feelancer21 this PR fixes the debuglevel updating but the estimator updating (callback function) is not working. Might be something basic that I'm missing ... Any help would be welcome!