Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: include esplora url in sync failed events #312

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions lnclient/ldk/ldk.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type LDKService struct {

const resetRouterKey = "ResetRouter"

func NewLDKService(ctx context.Context, cfg config.Config, eventPublisher events.EventPublisher, mnemonic, workDir string, network string, esploraServer string, gossipSource string) (result lnclient.LNClient, err error) {
func NewLDKService(ctx context.Context, cfg config.Config, eventPublisher events.EventPublisher, mnemonic, workDir string, network string) (result lnclient.LNClient, err error) {
if mnemonic == "" || workDir == "" {
return nil, errors.New("one or more required LDK configuration are missing")
}
Expand Down Expand Up @@ -99,10 +99,10 @@ func NewLDKService(ctx context.Context, cfg config.Config, eventPublisher events
builder := ldk_node.BuilderFromConfig(ldkConfig)
builder.SetEntropyBip39Mnemonic(mnemonic, nil)
builder.SetNetwork(network)
builder.SetEsploraServer(esploraServer)
if gossipSource != "" {
logger.Logger.WithField("gossipSource", gossipSource).Warn("LDK RGS instance set")
builder.SetGossipSourceRgs(gossipSource)
builder.SetEsploraServer(cfg.GetEnv().LDKEsploraServer)
if cfg.GetEnv().LDKGossipSource != "" {
logger.Logger.WithField("gossipSource", cfg.GetEnv().LDKGossipSource).Warn("LDK RGS instance set")
builder.SetGossipSourceRgs(cfg.GetEnv().LDKGossipSource)
} else {
logger.Logger.Warn("No LDK RGS instance set")
}
Expand Down Expand Up @@ -198,6 +198,7 @@ func NewLDKService(ctx context.Context, cfg config.Config, eventPublisher events
"sync_type": "full",
"initial_sync": true,
"node_type": config.LDKBackendType,
"esplora_url": ls.cfg.GetEnv().LDKEsploraServer,
},
})

Expand Down Expand Up @@ -264,9 +265,10 @@ func NewLDKService(ctx context.Context, cfg config.Config, eventPublisher events
ls.eventPublisher.Publish(&events.Event{
Event: "nwc_node_sync_failed",
Properties: map[string]interface{}{
"error": err.Error(),
"sync_type": "fee_estimates",
"node_type": config.LDKBackendType,
"error": err.Error(),
"sync_type": "fee_estimates",
"node_type": config.LDKBackendType,
"esplora_url": ls.cfg.GetEnv().LDKEsploraServer,
},
})
}
Expand All @@ -285,9 +287,10 @@ func NewLDKService(ctx context.Context, cfg config.Config, eventPublisher events
ls.eventPublisher.Publish(&events.Event{
Event: "nwc_node_sync_failed",
Properties: map[string]interface{}{
"error": err.Error(),
"sync_type": "full",
"node_type": config.LDKBackendType,
"error": err.Error(),
"sync_type": "full",
"node_type": config.LDKBackendType,
"esplora_url": ls.cfg.GetEnv().LDKEsploraServer,
},
})

Expand Down
2 changes: 1 addition & 1 deletion service/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (svc *service) launchLNBackend(ctx context.Context, encryptionKey string) e
Mnemonic, _ := svc.cfg.Get("Mnemonic", encryptionKey)
LDKWorkdir := path.Join(svc.cfg.GetEnv().Workdir, "ldk")

lnClient, err = ldk.NewLDKService(ctx, svc.cfg, svc.eventPublisher, Mnemonic, LDKWorkdir, svc.cfg.GetEnv().LDKNetwork, svc.cfg.GetEnv().LDKEsploraServer, svc.cfg.GetEnv().LDKGossipSource)
lnClient, err = ldk.NewLDKService(ctx, svc.cfg, svc.eventPublisher, Mnemonic, LDKWorkdir, svc.cfg.GetEnv().LDKNetwork)
case config.GreenlightBackendType:
Mnemonic, _ := svc.cfg.Get("Mnemonic", encryptionKey)
GreenlightInviteCode, _ := svc.cfg.Get("GreenlightInviteCode", encryptionKey)
Expand Down
Loading