@@ -451,6 +451,10 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
451451 return fmt .Errorf ("failed to get current block height: %w" , err )
452452 }
453453 blockHeight := getInfo .BlockHeight
454+ if blockHeight <= 0 {
455+ return fmt .Errorf ("invalid block height reported by lnd: %d" ,
456+ blockHeight )
457+ }
454458
455459 // If we're running an asset client, we'll log something here.
456460 if d .assetClient != nil {
@@ -586,7 +590,13 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
586590 ChainParams : d .lnd .ChainParams ,
587591 ChainNotifier : d .lnd .ChainNotifier ,
588592 }
589- staticAddressManager = address .NewManager (addrCfg , int32 (blockHeight ))
593+ staticAddressManager , err = address .NewManager (
594+ addrCfg , int32 (blockHeight ),
595+ )
596+ if err != nil {
597+ return fmt .Errorf ("unable to create static address manager: %w" ,
598+ err )
599+ }
590600
591601 // Static address deposit manager setup.
592602 depositStore := deposit .NewSqlStore (baseDb )
@@ -617,7 +627,13 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
617627 Signer : d .lnd .Signer ,
618628 Store : withdrawalStore ,
619629 }
620- withdrawalManager = withdraw .NewManager (withdrawalCfg , blockHeight )
630+ withdrawalManager , err = withdraw .NewManager (
631+ withdrawalCfg , blockHeight ,
632+ )
633+ if err != nil {
634+ return fmt .Errorf ("unable to create withdrawal manager: %w" ,
635+ err )
636+ }
621637
622638 // Static address loop-in manager setup.
623639 staticAddressLoopInStore := loopin .NewSqlStore (
@@ -645,7 +661,7 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
645661 return err
646662 }
647663
648- staticLoopInManager = loopin .NewManager (& loopin.Config {
664+ staticLoopInManager , err = loopin .NewManager (& loopin.Config {
649665 Server : staticAddressClient ,
650666 QuoteGetter : swapClient .Server ,
651667 LndClient : d .lnd .Client ,
@@ -663,6 +679,9 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
663679 MaxStaticAddrHtlcFeePercentage : d .cfg .MaxStaticAddrHtlcFeePercentage ,
664680 MaxStaticAddrHtlcBackupFeePercentage : d .cfg .MaxStaticAddrHtlcBackupFeePercentage ,
665681 }, blockHeight )
682+ if err != nil {
683+ return fmt .Errorf ("unable to create loop-in manager: %w" , err )
684+ }
666685
667686 var (
668687 reservationManager * reservation.Manager
0 commit comments