diff --git a/config.js b/config.js index 22585cb..1cc68ec 100644 --- a/config.js +++ b/config.js @@ -11,6 +11,7 @@ let config = { }, lnd: { url: '1.1.1.1:10009', + password: '', }, }; diff --git a/controllers/website.js b/controllers/website.js index 48682ff..fe14531 100644 --- a/controllers/website.js +++ b/controllers/website.js @@ -45,6 +45,7 @@ function updateLightning() { } catch (Err) { console.log(Err); } + console.log('updated'); } updateLightning(); setInterval(updateLightning, 60000); diff --git a/lightning.js b/lightning.js index ff02047..676b33d 100644 --- a/lightning.js +++ b/lightning.js @@ -25,4 +25,22 @@ let macaroonCreds = grpc.credentials.createFromMetadataGenerator(function(args, callback(null, metadata); }); let creds = grpc.credentials.combineChannelCredentials(sslCreds, macaroonCreds); + +// trying to unlock the wallet: +if (config.lnd.password) { + var walletUnlocker = new lnrpc.WalletUnlocker(config.lnd.url, creds); + walletUnlocker.unlockWallet( + { + wallet_password: config.lnd.password, + }, + function(err, response) { + if (err) { + console.log('unlockWallet failed, probably because its been aleady unlocked'); + } else { + console.log('unlockWallet:', response); + } + }, + ); +} + module.exports = new lnrpc.Lightning(config.lnd.url, creds);