Merge pull request 'Auto-unlock LND wallet/node' (#331) from feature/auto_unlock_lnd into chore/upgrade_bitcoin_software

Reviewed-on: #331
This commit is contained in:
Râu Cao 2021-07-01 13:21:41 +00:00
commit c60e65020b
4 changed files with 28 additions and 3 deletions

View File

@ -0,0 +1,10 @@
{
"id": "lnd",
"password": {
"encrypted_data": "etEgstimoXqyD8HhZZ7rKW0+LW3rnYAR3f++AOv6SA==\n",
"iv": "g9LA7GpA6eV1ZAJu\n",
"auth_tag": "wv67Nliq0HGqAhVeyhNO/g==\n",
"version": 3,
"cipher": "aes-256-gcm"
}
}

View File

@ -45,8 +45,9 @@ node.default['lnd']['public_ip'] = '148.251.237.111'
node.default['lnd']['public_port'] = '9735'
node.default['lnd']['port'] = '9736'
node.default['lnd']['minchansize'] = '1000000'
node.default['lnd']['basefee'] = '500'
node.default['lnd']['feerate'] = '1'
node.default['lnd']['basefee'] = '1000'
node.default['lnd']['feerate'] = '50'
node.default['lnd']['auto_unlock'] = true # requires credentials/lnd data bag item
node.default['rtl']['repo'] = 'https://github.com/Ride-The-Lightning/RTL.git'
node.default['rtl']['revision'] = 'v0.11.0'

View File

@ -17,7 +17,7 @@ bash "compile_lnd" do
cwd node['lnd']['source_dir']
code <<-EOH
source /etc/profile.d/golang.sh
make clean && make && make install
make clean && make && make install tags="signrpc walletrpc chainrpc invoicesrpc"
EOH
action :nothing
notifies :restart, "systemd_unit[lnd.service]", :delayed
@ -36,6 +36,17 @@ directory lnd_dir do
action :create
end
if node['lnd']['auto_unlock']
lnd_credentials = Chef::EncryptedDataBagItem.load('credentials', 'lnd')
file "#{lnd_dir}/.unlock.txt" do
content lnd_credentials['password']
mode '0600'
owner bitcoin_user
group bitcoin_group
end
end
template "#{lnd_dir}/lnd.conf" do
source "lnd.conf.erb"
owner bitcoin_user
@ -49,6 +60,8 @@ template "#{lnd_dir}/lnd.conf" do
lnd_minchansize: node['lnd']['minchansize'],
lnd_basefee: node['lnd']['basefee'],
lnd_feerate: node['lnd']['feerate'],
lnd_dir: lnd_dir,
auto_unlock: node['lnd']['auto_unlock'],
bitcoin_datadir: node['bitcoin']['datadir'],
bitcoin_rpc_user: node['bitcoin']['conf']['rpcuser'],
bitcoin_rpc_password: bitcoin_credentials["rpcpassword"],

View File

@ -6,6 +6,7 @@ alias=<%= @lnd_alias %>
color=<%= @lnd_color %>
maxpendingchannels=2
minchansize=<%= @lnd_minchansize %>
<% if @auto_unlock %>wallet-unlock-password-file=<%= @lnd_dir %>/.unlock.txt<% end %>
[autopilot]
autopilot.active=0