LndHub icon indicating copy to clipboard operation
LndHub copied to clipboard

Fix issue with LndHub & Polar which runs regtest instances

Open bilthon opened this issue 3 years ago • 3 comments

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.

bilthon avatar Feb 21 '22 02:02 bilthon

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.

ChayanonSaelee avatar Feb 21 '22 03:02 ChayanonSaelee

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.

bilthon avatar Feb 21 '22 14:02 bilthon

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.

zzzhan avatar Aug 19 '22 03:08 zzzhan