lightninglabs / loop

Lightning Loop: A Non-Custodial Off/On Chain Bridge
MIT License
558 stars 116 forks source link

Enable AutoLoop: setparams permission denied #468

Closed sotarules closed 2 years ago

sotarules commented 2 years ago

Expected behavior

Entering command loop setparams I was expecting autoloop to be enabled.

Actual behavior

[loop] rpc error: code = Unknown desc = permission denied

To reproduce

100% reproducible on my system

System information

Using stand-alone loop through command line interface. Loop version is 0.17.0-beta I am building from go using go install ./.. This is on a Qotom i5 celeron machine running Ubuntu Impish.

Other

All other functions such as loop monitor work fine - I just cannot perform setparams. By the way thanks in advance for you help, I've tried a bunch of things including playing with the macaroons, but nothing has seemed to fix this. I don't understand whether the issue is related to loop versus lnd macaroons, or whether macaroons are the issue at all.

2022-03-14 13:37:31.101 [INF] LOOPD: Version: 0.17.0-beta commit=
2022-03-14 13:37:31.102 [INF] LNDC: Creating lnd connection to localhost:10009
2022-03-14 13:37:31.104 [INF] LNDC: Connected to lnd
2022-03-14 13:37:31.117 [INF] LNDC: Waiting for lnd to unlock
2022-03-14 13:37:31.119 [INF] LNDC: Wallet state of lnd is now: Wallet is unlocked
2022-03-14 13:38:26.729 [INF] LNDC: Wallet state of lnd is now: Lnd RPC server is ready for requests
2022-03-14 13:38:36.935 [INF] LNDC: lnd version: v0.14.2-beta.rc2, build tags 'signrpc,walletrpc,chainrpc,invoicesrpc,routerrpc'
2022-03-14 13:38:36.935 [INF] LNDC: Using network mainnet
2022-03-14 13:38:36.936 [INF] LNDC: Waiting for lnd to be fully synced to its chain backend, this might take a while
2022-03-14 13:38:59.856 [INF] LNDC: lnd is now fully synced to its chain backend
2022-03-14 13:38:59.856 [INF] LOOPD: Swap server address: swap.lightning.today:11010
2022-03-14 13:38:59.864 [INF] STORE: Checking for schema update: latest_version=4, db_version=4
2022-03-14 13:39:00.360 [INF] LOOPD: Waiting for updates
2022-03-14 13:39:00.360 [INF] LOOPD: Starting swap client
2022-03-14 13:39:00.360 [INF] LOOPD: Starting liquidity manager
2022-03-14 13:39:00.360 [INF] LOOPD: Starting gRPC listener
2022-03-14 13:39:00.360 [INF] LOOP: Connected to lnd node 'SOTA' with pubkey 0280d500886fd3bddb7160afa3d3fe41b94b74dd97853902c16d0575d2ecf8ff97 (version v0.14.2-beta.rc2, build tags 'signrpc,walletrpc,chainrpc,invoicesrpc,routerrpc')
2022-03-14 13:39:00.363 [INF] LOOPD: Starting REST proxy listener
2022-03-14 13:39:00.363 [INF] LOOPD: RPC server listening on 127.0.0.1:11010
2022-03-14 13:39:00.364 [INF] LOOPD: REST proxy listening on 127.0.0.1:8081
2022-03-14 13:39:00.366 [INF] LOOP: Wait for first block ntfn
2022-03-14 13:39:00.377 [INF] LOOP: Starting event loop at height 727350
2022-03-14 13:39:26.754 [INF] LOOPD: Monitor request received
levmi commented 2 years ago

What was the exact command that led to that error? Did you start with the command: loop setparams --autoloop=true?

sotarules commented 2 years ago

@levmi correct loop setparams --autoloop=true

levmi commented 2 years ago

Can you attempt to delete your existing macaroon and restart loopd? When you upgrade your Loop instance and there are new permissions added to the API, the old macaroon doesn't have those permissions. So, you just need to get rid of it and re-start loopd. That should fix this. But, let me know if not.

sotarules commented 2 years ago

@levmi based on your recommendation I tried this, I deleted both loop.macaroon and loop.macadmin and I was thinking that the system would automatically re-create the macaroons, but when I issue command loop monitor I get this:

[loop] unable to read macaroon path : open /root/.loop/mainnet/loop.macaroon: no such file or directory

levmi commented 2 years ago

Did you restart loopd?

sotarules commented 2 years ago

@levmi I did supervisorctl stop loopd followed by supervisorctl start loopd but here is good news: I rebooted completely and my script restarted bitcoind, lnd, loop and pool. Now I see the system did re-create loop.macaroon and so things are looking better. But now when I try loop setparams --autoloop=true I get this:

[loop] rpc error: code = InvalidArgument desc = unknown protocol version: 9

I want you to know that I'm building lnd from branch v0-14-2-branch-rc2 - this was just an experiment I did, normally I build lnd from branch master. Not sure whether this is relevant.

I'm excited--I feel that we're on the verge of solving this and I'll be getting AutoLoop benefits. Thanks for your help!

Here is my /etc/supervisor/conf.d/loopd.conf:

[program:loopd]
user=root
command=sh -c "sleep 60;/root/go/bin/loopd --lnd.macaroonpath=/root/.lnd/data/chain/bitcoin/mainnet/admin.macaroon"
stderr_logfile=/root/loopd-stderr.log
stdout_logfile=/root/loopd-stdout.log
startretries=999999999999999999999999999
startsecs=0
exitcodes=0,1,2
autostart=false
autorestart=true

Not sure whether this is helpful. Note that I'm setting the --lnd.macaroonpath to the default lnd admin.macaroon

I'm rebuilding lnd from branch master now just for good measure.

Rebuilding lnd from master was not a good idea, a problem that is beyond the scope of this issue surfaced. I feel back to v0-14-2-branch-rc2

levmi commented 2 years ago

Based on your other comment, this is working now too? Gonna close it out, but feel free to re-open if this is still happening.