Skip to content

Commit

Permalink
chore: remove old scb restore code (moved to hub-recovery tool) (#871)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz authored Dec 10, 2024
1 parent cf09632 commit 4e47c18
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
25 changes: 1 addition & 24 deletions lnclient/ldk/ldk.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ type LDKService struct {

const resetRouterKey = "ResetRouter"

// TODO: remove staticChannelsBackup *events.StaticChannelsBackupEvent, restoredFromSeed bool (we have a dedicated SCB recovery tool)
func NewLDKService(ctx context.Context, cfg config.Config, eventPublisher events.EventPublisher, mnemonic, workDir string, network string, staticChannelsBackup *events.StaticChannelsBackupEvent, restoredFromSeed bool, vssToken string) (result lnclient.LNClient, err error) {
func NewLDKService(ctx context.Context, cfg config.Config, eventPublisher events.EventPublisher, mnemonic, workDir string, network string, vssToken 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 @@ -124,12 +123,6 @@ func NewLDKService(ctx context.Context, cfg config.Config, eventPublisher events
// The liquidity source below is not used because we do not use the native LDK-node LSPS2 API.
builder.SetLiquiditySourceLsps2("52.88.33.119:9735", lsp.OlympusLSP().Pubkey, nil)

// recover from backup
if staticChannelsBackup != nil {
// add backed up channel monitors to LDK DB
builder.RestoreEncodedChannelMonitors(getEncodedChannelMonitorsFromStaticChannelsBackup(staticChannelsBackup))
}

logger.Logger.WithFields(logrus.Fields{
"vss_enabled": vssToken != "",
}).Info("Creating node")
Expand Down Expand Up @@ -208,22 +201,6 @@ func NewLDKService(ctx context.Context, cfg config.Config, eventPublisher events
return nil, err
}

if restoredFromSeed {
// generate some onchain addresses in case there were funds on them (when importing from an existing seed)
// NOTE: this may not be enough. The user could click the get new address button to fetch more addresses
// (this will probably be improved with BDK 1.0 anyway)
func() {
for i := 0; i < 10; i++ {
ls.node.OnchainPayment().NewAddress()
}
}()
}

// recover from backup
if staticChannelsBackup != nil {
forceCloseChannelsFromStaticChannelsBackup(node, staticChannelsBackup)
}

logger.Logger.WithFields(logrus.Fields{
"nodeId": nodeId,
"status": node.Status(),
Expand Down
2 changes: 1 addition & 1 deletion service/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (svc *service) launchLNBackend(ctx context.Context, encryptionKey string) e
}
vssEnabled = vssToken != ""

lnClient, err = ldk.NewLDKService(ctx, svc.cfg, svc.eventPublisher, mnemonic, ldkWorkdir, svc.cfg.GetEnv().LDKNetwork, nil, false, vssToken)
lnClient, err = ldk.NewLDKService(ctx, svc.cfg, svc.eventPublisher, mnemonic, ldkWorkdir, svc.cfg.GetEnv().LDKNetwork, vssToken)
case config.GreenlightBackendType:
Mnemonic, _ := svc.cfg.Get("Mnemonic", encryptionKey)
GreenlightInviteCode, _ := svc.cfg.Get("GreenlightInviteCode", encryptionKey)
Expand Down

0 comments on commit 4e47c18

Please sign in to comment.