zcash/lightwalletd

{"app":"lightwalletd","error":"stat : no such file or directory","level":"warning","msg":"error with getblockchaininfo rpc}

hhanh00 opened this issue · 4 comments

What is the bug?
LWD won't start. There is an error "no such file..."

Additional context

Looks like I'm missing a step?

It is classified as a warning but the server won't continue.

hanh@vm1760312:~/lightwalletd$ ./start.sh 
{"app":"lightwalletd","buildDate":"2023-10-20","buildUser":"hanh","gitCommit":"b805382ac34e91678ed0d06e9c5f84187ac630cc","level":"info","msg":"Starting gRPC server version v0.4.16 on 127.0.0.1:9067","time":"2023-10-20T05:13:42+03:00"}
{"app":"lightwalletd","error":"stat : no such file or directory","level":"warning","msg":"error with getblockchaininfo rpc, retrying...","retry":1,"time":"2023-10-20T05:13:42+03:00"}
^Chanh@vm1760312:~/lightwalletd$ cat start.sh 
./lightwalletd --data-dir=$HOME/.cache/lightwalletd --tls-cert $HOME/.config/fullchain.pem --tls-key $HOME/.config/privkey.pem --zcash-conf-path $HOME/.config/zebrad.toml --log-file /dev/stdout
hanh@vm1760312:~/lightwalletd$ curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8232/
{"result":{"chain":"main","blocks":2267485,"bestblockhash":"0000000001193d5ed65ca32ac70f9b68dce1a25af55606d2e7a4d8460efa3406","estimatedheight":2267485,"upgrades":{"5ba81b19":{"name":"Overwinter","activationheight":347500,"status":"active"},"76b809bb":{"name":"Sapling","activationheight":419200,"status":"active"},"2bb40e60":{"name":"Blossom","activationheight":653600,"status":"active"},"f5b9230b":{"name":"Heartwood","activationheight":903000,"status":"active"},"e9ff75a6":{"name":"Canopy","activationheight":1046400,"status":"active"},"c2d6d0b4":{"name":"NU5","activationheight":1687104,"status":"active"}},"consensus":{"chaintip":"c2d6d0b4","nextblock":"c2d6d0b4"}},"id":"curltest"}

I think I can reproduce the problem. At first I couldn't, but then I noticed that my .zcash/zcash.conf file includes lines to specify rpcuser and rpcpassword. I removed those, and then this exact problem occurred (or at least the same symptom).

Can you try specifying those two options in the zcashd configuration and see if the problem still exists? It doesn't matter what you set the user and password strings to; lightwalletd opens the config file, extracts them, and uses them when submitting RPCs to zcashd. I'm not sure what happens if they're not specified, in other words, why that fails, but I'll dig into it. We haven't changed this part of the code in at least the last several years.

Even if this works, it's confusing and unacceptable, so I'll see if I can fix it. If adityapk00's version works, I can figure out why and make it work for our lightwalletd also. I'll try to get that done in the next few days.

At the very least, the documentation should say that setting those configuration options is required, and the error message should be much better.

Thanks for the bug report!

Thanks, it works with rpcuser & rpcpassword but only if they are top-level options (not under [rpc]).

I tested https://github.com/adityapk00/lightwalletd (its latest commit, a67fcec) with the rpcuser and rpcpassword not present in zcash.conf. I was expecting, from your comment above, that this would work. But it fails with a different error:

{"app":"lightwalletd","error":"status code: 401, response: \"\"","level":"warning","msg":"error with getblockchaininfo rpc, retrying...","retry":1,"time":"2023-10-26T13:33:05-06:00"}

(With rpcuser and rpcsassword specified, it works.)

Anyway, that's probably not important. I'll try to fix this problem so that it's not necessary to specify these two rpc configuration settings. At least you're not being blocked now (or let me know if you still are blocked).

... but only if they are top-level options (not under [rpc]).

I'm pretty sure zcash.conf doesn't support sections, like bitcoin.conf does (if that's what you're familiar with).

It turns out it's not possible to not specify rpcpassword (or if it is possible, it would require using an entirely different library, if there even is one, to do the zcashd RPCs). It turns out that specifying rpcuser isn't required, only rpcpassword. With PR #463, lightwalletd will fail during startup (instead of retrying the initial RPC endlessly) with a clear error message. I think is the best we can reasonably do, at least for now.