subservers+terminal: move overwriting agent name

This commit is contained in:
Elle Mouton 2023-05-02 11:43:52 +02:00
parent a3a5d636e6
commit 53d0d8432e
No known key found for this signature in database
GPG key ID: D7D916376026F177
3 changed files with 9 additions and 8 deletions

View file

@ -5,6 +5,7 @@ import (
restProxy "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/lightninglabs/lndclient"
"github.com/lightninglabs/loop"
"github.com/lightninglabs/loop/loopd"
"github.com/lightninglabs/loop/looprpc"
"github.com/lightningnetwork/lnd/lnrpc"
@ -27,6 +28,10 @@ var _ SubServer = (*loopSubServer)(nil)
func NewLoopSubServer(cfg *loopd.Config, remoteCfg *RemoteDaemonConfig,
remote bool) SubServer {
// Overwrite the loop daemon's user agent name, so it sends "litd"
// instead of "loopd".
loop.AgentName = "litd"
return &loopSubServer{
Daemon: loopd.New(cfg, nil),
cfg: cfg,

View file

@ -27,6 +27,10 @@ var _ SubServer = (*poolSubServer)(nil)
func NewPoolSubServer(cfg *pool.Config, remoteCfg *RemoteDaemonConfig,
remote bool) SubServer {
// Overwrite the pool daemon's user agent name, so it sends "litd"
// instead of and "poold".
pool.SetAgentName("litd")
return &poolSubServer{
Server: pool.NewServer(cfg),
cfg: cfg,

View file

@ -31,8 +31,6 @@ import (
"github.com/lightninglabs/lightning-terminal/session"
"github.com/lightninglabs/lightning-terminal/subservers"
"github.com/lightninglabs/lndclient"
"github.com/lightninglabs/loop"
"github.com/lightninglabs/pool"
"github.com/lightningnetwork/lnd"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/chainreg"
@ -1413,16 +1411,10 @@ func (g *LightningTerminal) initSubServers() {
g.cfg.faradayRemote,
))
// Overwrite the loop daemon's user agent name so it sends "litd"
// instead of "loopd".
loop.AgentName = "litd"
g.subServerMgr.AddServer(subservers.NewLoopSubServer(
g.cfg.Loop, g.cfg.Remote.Loop, g.cfg.loopRemote,
))
// Overwrite the pool daemon's user agent name so it sends "litd"
// instead of and "poold".
pool.SetAgentName("litd")
g.subServerMgr.AddServer(subservers.NewPoolSubServer(
g.cfg.Pool, g.cfg.Remote.Pool, g.cfg.poolRemote,
))