BlueWallet / LndHub

Wrapper for Lightning Network Daemon. It provides separate accounts for end-users
http://LndHub.io
MIT License
745 stars 180 forks source link

Unable to refill Bluewallet's Lightning Wallet using self-hosted LNDHub #532

Closed Javihache closed 1 year ago

Javihache commented 1 year ago

Creating a new Lightning Wallet on BlueWallet using my own personal LndHub service on a Raspberry Pi, I am unable to refill the wallet. LND shows the transactions all fine, but they are not shown on BlueWallet. Additionally, refreshing the Empty wallet gives the following error:

Jan 20 08:50:02 hachepi node[2828023]: listtransactions error: RangeError: Maximum call stack size exceeded Jan 20 08:50:02 hachepi node[2828023]: at User._listtransactions (/home/bitcoin/LndHub/build/class/User.js:395:20) Jan 20 08:50:02 hachepi node[2828023]: at runMicrotasks (<anonymous>) Jan 20 08:50:02 hachepi node[2828023]: at processTicksAndRejections (node:internal/process/task_queues:96:5) Jan 20 08:50:02 hachepi node[2828023]: at async User.getTxs (/home/bitcoin/LndHub/build/class/User.js:314:15) Jan 20 08:50:02 hachepi node[2828023]: at async User.getCalculatedBalance (/home/bitcoin/LndHub/build/class/User.js:159:15) Jan 20 08:50:02 hachepi node[2828023]: at async User.getBalance (/home/bitcoin/LndHub/build/class/User.js:139:17) Jan 20 08:50:02 hachepi node[2828023]: at async /home/bitcoin/LndHub/build/controllers/api.js:377:19

I've tried creating new accounts, deleting the redis DB and recreating it and then creating new accounts. Both Refill and Refill from External Wallet.

Nothing works, the balance doesn't show after more than 3 confirmations. Only lnd's wallet receives the payments all fine.

Overtorment commented 1 year ago

looks like the root cause is listtransactions error: RangeError: Maximum call stack size exceeded so lndhub cant get the list of onchain transactions to actually credit your account.

i feel there is a misconfiguration somewhere, maybe lndhub cant access bitcoind

Javihache commented 1 year ago

I don't have bitcoind configured on my configuration. It should use lnd's bitcoin wallet by default this way, right?

Overtorment commented 1 year ago

yes

Overtorment commented 1 year ago

iirc, in your config.js file there must not be a bitcoind record

Javihache commented 1 year ago

There's definitely no bitcoind config, it's commented out.

What else could be the problem then? Do I maybe need to use the REST port instead of gRPC?

Overtorment commented 1 year ago

its weird because error message looks like theres an infinite recursion, which i cant understand.

so, it looks like this piece of code doesnt return the tx list from lnd: https://github.com/BlueWallet/LndHub/blob/fb023b02be53b47a0b5b837001fc7b08dd7f3bd1/class/User.js#L425

i would start putting debug prints around this part to see whats really going on there

Javihache commented 1 year ago

I'll do that. Could it have to do with LND being run from Lightning Terminal?

Javihache commented 1 year ago

Solved the problem by adding bitcoind credentials. This causes another problem if bitcoin.conf has option "disablewallet=1". Commenting out "disablewallet=1" and restarting bitcoind fixed the problem.

Apparently not having bitcoind credentials in config.js when building breaks lndhub as of lately. If you experience this problem, add the RPC bitcoind credentials and rebuild the application with babel. Then start it and it should work fine.