diff --git a/walletunlocker/service.go b/walletunlocker/service.go index 9855f22a..0c3c0b3d 100644 --- a/walletunlocker/service.go +++ b/walletunlocker/service.go @@ -160,6 +160,17 @@ func New(chainDir string, params *chaincfg.Params, noFreelistSync bool, } } +// WalletExists returns whether a wallet exists on the file path the +// UnlockerService is using. +func (u *UnlockerService) WalletExists() (bool, error) { + netDir := btcwallet.NetworkDir(u.chainDir, u.netParams) + loader := wallet.NewLoader( + u.netParams, netDir, u.noFreelistSync, u.dbTimeout, 0, + ) + + return loader.WalletExists() +} + // GenSeed is the first method that should be used to instantiate a new lnd // instance. This method allows a caller to generate a new aezeed cipher seed // given an optional passphrase. If provided, the passphrase will be necessary