ADD: lnd wallet unlock attempt upon start
This commit is contained in:
parent
0f75933bf0
commit
1df24d0e80
@ -11,6 +11,7 @@ let config = {
|
|||||||
},
|
},
|
||||||
lnd: {
|
lnd: {
|
||||||
url: '1.1.1.1:10009',
|
url: '1.1.1.1:10009',
|
||||||
|
password: '',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ function updateLightning() {
|
|||||||
} catch (Err) {
|
} catch (Err) {
|
||||||
console.log(Err);
|
console.log(Err);
|
||||||
}
|
}
|
||||||
|
console.log('updated');
|
||||||
}
|
}
|
||||||
updateLightning();
|
updateLightning();
|
||||||
setInterval(updateLightning, 60000);
|
setInterval(updateLightning, 60000);
|
||||||
|
18
lightning.js
18
lightning.js
@ -25,4 +25,22 @@ let macaroonCreds = grpc.credentials.createFromMetadataGenerator(function(args,
|
|||||||
callback(null, metadata);
|
callback(null, metadata);
|
||||||
});
|
});
|
||||||
let creds = grpc.credentials.combineChannelCredentials(sslCreds, macaroonCreds);
|
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);
|
module.exports = new lnrpc.Lightning(config.lnd.url, creds);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user