Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On-chain funds are missing from user balance (code disabled) #331

Open
raucao opened this issue Nov 30, 2021 · 17 comments
Open

On-chain funds are missing from user balance (code disabled) #331

raucao opened this issue Nov 30, 2021 · 17 comments

Comments

@raucao
Copy link

raucao commented Nov 30, 2021

I was wondering why my on-chain refill from Blue Wallet didn't show up in my lndhub account balance. Didn't have to go far to find out that the code is just disabled with a return and a "TODO" comment to re-activate it.

As there's no issue for this, I'm creating one. Maybe one of the core developers could let us know why it's disabled, and what needs to be done in order to remove the return statement again?

LndHub/class/User.js

Lines 506 to 508 in 9563cb9

async accountForPosibleTxids() {
return; // TODO: remove
let onchain_txs = await this.getTxs();

Edit: simply removing the line results in the following exception when calculating the balance:

listtransactions error: Error: {"result":null,"error":{"code":-18,"message":"Requested wallet does not exist or is not loaded"},"id":"a7fa1613-b9e8-4aaf-b817-7c7deafad634"}
    at IncomingMessage.<anonymous> (/opt/lndhub/node_modules/jayson/lib/client/http.js:78:23)
    at IncomingMessage.emit (events.js:326:22)
    at IncomingMessage.EventEmitter.emit (domain.js:483:12)
    at endReadableNT (_stream_readable.js:1241:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  code: 500
}
@xraid
Copy link
Contributor

xraid commented Dec 1, 2021

depending how You deployed LndHub on what kind of distro, the config is pointing to a bitcoind wallet that for ex. Umbrel and the like do not have initialized and therefore error, most "user" nodes only use and have need for the LND wallet but for BIG deployments as for ex. lndhub.io, it would offload address lookup to bitcoind direct instead using LND for address lockup ? and changes been made to not use that function any more for some or other reason.

so lets go back to that You do not se Your tx in BlueWallet or in LND ?

@raucao
Copy link
Author

raucao commented Dec 1, 2021

Thanks. I don't quite see how what you're saying is relevant to commenting the function and thus not accounting for on-chain balances altogeher, no matter the on-chain wallet backend.

so lets go back to that You do not se Your tx in BlueWallet or in LND ?

Blue Wallet is irrelevant to this issue. The tx is visible in LND, but not accounting for the user balance in the lndhub API.

@xraid
Copy link
Contributor

xraid commented Dec 2, 2021

when You enable the disabled function it says :

"Requested wallet does not exist or is not loaded"

and i tried explain to You depending on Your distro and configuration it might not have a initialized bitcoind wallet but are only using the LND wallet.

@xraid
Copy link
Contributor

xraid commented Dec 2, 2021

the user account wallet(card) will have a bitcoin address You can get by :

LndHub-URL/getbtc
header { content-type: application/json, authorization: Bearer access_token }

LndHub-URL/getbalance
header { content-type: application/json, authorization: Bearer access_token }

will return amount sats in paid invoices and tx of bitcoind address shown in the user account wallet(card)

so Your refill should reflect in amount sats in associated account shown in the user account wallet(card)

@xraid
Copy link
Contributor

xraid commented Dec 2, 2021

and if You use :

LndHub-URL/gettxs
header { content-type: application/json, authorization: Bearer access_token }

You will see tx´s for the associated bitcoin address

@raucao
Copy link
Author

raucao commented Dec 2, 2021

My entire issue is about the associated bitcoin address's incoming transactions not showing up in the balance.

@Javihache
Copy link

Javihache commented Dec 30, 2021

My entire issue is about the associated bitcoin address's incoming transactions not showing up in the balance.

I have the exact same problem and none of the answers of xraid made any smarter as to what might be going on. @raucao did you manage to solve the issue? I am sending on-chain using BlueWallet trying to top up a newly created lndhub lightning wallet and it's no updating. The LND on-chain wallet receives the transaction but LNDhub cannot see it. I get the same error in the logs: listtransactions error: { Error: {"result":null,"error":{"code":-32601,"message":"Method not found"},

@xraid
Copy link
Contributor

xraid commented Dec 30, 2021

in Your config.js can You comment out :
// bitcoind: {
// rpc: 'http://login:[email protected]:8332/wallet/wallet.dat',
// },
restart and report back

@raucao
Copy link
Author

raucao commented Dec 30, 2021

@Javihache I'm not sure what @xraid thinks is happening, but those replies are not addressing the issue I reported. Nothing you change in the config can magically remove a return statement in the code.

@xraid
Copy link
Contributor

xraid commented Dec 30, 2021

@raucao hehe
and You would know

@Overtorment
Copy link
Member

i checked the code, and accountForPosibleTxids() is deprecated and should be deleted

@Overtorment
Copy link
Member

error "Requested wallet does not exist or is not loaded" suggests that bitcoind is misconfigured.
for a very basic usage scenario, you dont need to use bitcoind with LNDHUB, as it wil just fetch onchain data from LND.

@raucao
Copy link
Author

raucao commented Jan 7, 2022

Thanks.

i checked the code, and accountForPosibleTxids() is deprecated and should be deleted

What does that mean exactly for on-chain balance accounting? And where is that documented? We're simply trying to top up accounts with BlueWallet, and there's no error message anywhere, until you remove that undocumented return statement.

error "Requested wallet does not exist or is not loaded" suggests that bitcoind is misconfigured.
for a very basic usage scenario, you dont need to use bitcoind with LNDHUB, as it wil just fetch onchain data from LND.

If it's misconfigured, then why does BlueWallet show us valid LND on-chain addresses, which we can successfully receive money on that can then be used to open channels?

The answers to these questions would be helpful for fixing the problem for everyone running into it. However, as it is, the released version simply ignores incoming transactions to the on-chain address that is generated from the other endpoint, without telling the user (i.e. provider) why.

@raucao
Copy link
Author

raucao commented Jan 7, 2022

We use this config line from the release's code, just with a valid username, password and localhost IP:

rpc: 'http://login:[email protected]:8332/wallet/wallet.dat',

(The values we use mirror exactly LND's own [bitcoind] RPC config.)

@Overtorment
Copy link
Member

lndhub takes an onchain address from lnd, and if bitcoind is configured, registers it in bitcoind so its tracked and we can fetch related transactions from bitcoind.
if bitcoind is not configured, we fallback to checking onchain transactions from lnd (which uses neutrino).
so, your onchain coins always land on lnd successfully, its just a matter of seeing those transactions or not.

relevant code: class/User.js:406

@Overtorment
Copy link
Member

to configure your bitcoind, look into why it didnt load default wallet, or maybe your default wallet is called differently or smth. i rarely touch this part so not super familiar with it.

again, if you dont plan to switch lnd on-the-fly as a failover for better service availability, its better to just remove bitcoind configuration and rely on lnd here.

@raucao
Copy link
Author

raucao commented Jan 8, 2022

Thanks. There is nothing wrong with the default wallet of that bitcoind node per se. I can use it via bitcoin-cli, for example to list transactions with it. I guess it could still be an issue with the RPC URL in the example, but haven't looked into it further.

Removing the bitcoind config entirely works. (However, it still requires removing the return statement that is marked as TODO in the released code, of course.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants