BlueWallet / LndHub

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

Fix issue with LndHub & Polar which runs regtest instances #379

Open bilthon opened 2 years ago

bilthon commented 2 years ago

I'm experimenting with LndHub and a regtest bitcoin & lightning network powered by polar.

Regtest addresses it turns out have different prefix than testnet (bcrt), this causes the balance presented by LndHub to be always zero when no bitcoin core node is specified.

This happens because decodeRawTx takes only mainnet as default parameter.

I'd propose being able to set the network type in the configuration file as well in order to facilitate development on regtest and testnet. This might solve/respond issue #369 as well.

ChayanonSaelee commented 2 years ago

that means I must edit in class User.js from const decodedTx = decodeRawHex(tx.raw_tx_hex); to
const decodedTx = decodeRawHex(tx.raw_tx_hex, config.network); and in config.js add const bitcoin = require('bitcoinjs-lib')
network: bitcoin.networks.testnet and change .bitcoin to .testnet ?

but I tried it not working it still show 0 balance.

I want to show balance in testnet and use balance in testnet for testing pay invoice form starblock website.

bilthon commented 2 years ago

Bear in mind that you should also remove bitcoin core from the config file, as _getChainTransactions is only called if there's no bitcoind field in config.

zzzhan commented 1 year ago

I propose the lightning info need to pass to the class User.js, then get the network type from it and pass to the decodeRawHex.