Skip to content

Commit 58d5508

Browse files
committed
server+tapcfg: add chain params as standalone param
To be able to have some stateless server components be ready before the server is fully started up, we do need to have the chain params available. So we add them separately from the main config.
1 parent 168700c commit 58d5508

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

server.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/davecgh/go-spew/spew"
1616
proxy "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
1717
"github.com/lightninglabs/lndclient"
18+
"github.com/lightninglabs/taproot-assets/address"
1819
"github.com/lightninglabs/taproot-assets/fn"
1920
"github.com/lightninglabs/taproot-assets/monitoring"
2021
"github.com/lightninglabs/taproot-assets/perms"
@@ -55,6 +56,8 @@ type Server struct {
5556
// work.
5657
ready chan bool
5758

59+
chainParams *address.ChainParams
60+
5861
cfg *Config
5962

6063
*rpcServer
@@ -65,11 +68,12 @@ type Server struct {
6568
}
6669

6770
// NewServer creates a new server given the passed config.
68-
func NewServer(cfg *Config) *Server {
71+
func NewServer(chainParams *address.ChainParams, cfg *Config) *Server {
6972
return &Server{
70-
cfg: cfg,
71-
ready: make(chan bool),
72-
quit: make(chan struct{}, 1),
73+
chainParams: chainParams,
74+
cfg: cfg,
75+
ready: make(chan bool),
76+
quit: make(chan struct{}, 1),
7377
}
7478
}
7579

tapcfg/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ func CreateServerFromConfig(cfg *Config, cfgLogger btclog.Logger,
633633
LetsEncryptDomain: cfg.RpcConf.LetsEncryptDomain,
634634
}
635635

636-
return tap.NewServer(serverCfg), nil
636+
return tap.NewServer(&serverCfg.ChainParams, serverCfg), nil
637637
}
638638

639639
// ConfigureSubServer updates a Taproot Asset server with the given CLI config.

0 commit comments

Comments
 (0)