lnd icon indicating copy to clipboard operation
lnd copied to clipboard

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

Open feelancer21 opened this issue 1 year ago • 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.

feelancer21 avatar May 29 '24 21:05 feelancer21

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.

guggero avatar May 30 '24 07:05 guggero

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

MPins avatar Jun 06 '24 20:06 MPins

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?

MPins avatar Jun 08 '24 20:06 MPins

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: https://github.com/lightningnetwork/lnd/blob/789c6bac8ca4b75d15e9e40f8ded8e394df518bb/lnrpc/routerrpc/router_server.go#L948 That then seems to call into this: https://github.com/lightningnetwork/lnd/blob/24080c51f9e37f7230f48b67c72b5da5f1fa6139/routing/missioncontrol.go#L292

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: https://github.com/lightningnetwork/lnd/blob/eaa85920ea1dca750eaa31b6f23c161135df24b0/server.go#L927 where you have s.cfg available.

guggero avatar Jun 09 '24 13:06 guggero

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 ...

MPins avatar Jun 15 '24 22:06 MPins

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

https://github.com/lightningnetwork/lnd/blob/68494fd91d69ccdd3e72a5eaca593b6e42babe23/routing/localchans/manager.go#L21-L25

The function is passed here to the manager.

https://github.com/lightningnetwork/lnd/blob/68494fd91d69ccdd3e72a5eaca593b6e42babe23/server.go#L1045-L1050

feelancer21 avatar Jun 16 '24 06:06 feelancer21

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

https://github.com/lightningnetwork/lnd/blob/68494fd91d69ccdd3e72a5eaca593b6e42babe23/routing/localchans/manager.go#L21-L25

The function is passed here to the manager.

https://github.com/lightningnetwork/lnd/blob/68494fd91d69ccdd3e72a5eaca593b6e42babe23/server.go#L1045-L1050

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

MPins avatar Jun 16 '24 11:06 MPins

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!

MPins avatar Jun 22 '24 12:06 MPins