SatoshiPortal / cyphernode

Modular Bitcoin full-node microservices API server architecture and utilities toolkit to build scalable, secure and featureful apps and services without trusted third parties
MIT License
363 stars 68 forks source link

Error funding the Lightning wallet #139

Closed chrisjmccreadie closed 4 years ago

chrisjmccreadie commented 4 years ago

I cannot seem to fund the Lightning wallet, the on-chain balance always shows 0.

The methods I have tried are:

via API using:

ln_newaddr

calling c-lighting directly the docker container:

exec lightning-cli --lightning-dir=.lightning newaddr

Directly from the spark wallet GUI

https://127.0.0.1/sparkwallet/#/deposit

I can see the transactions in the blockchain but they do not show up in spark/c-lightning. I have tried the getbalance command from the API as well as listfunds directly with c-lightning and even getbalance (In all 4 wallets as a last-ditch attempt). An example of me funding the spark wallet can be seen below.

https://www.blockchain.com/btctest/address/2N2RsxZH6SpJ47WaJ9jyHvEikZkA7eWY7Vf

This could be an isolated issue for me/my setup but when I use the Bitcoin side of things I can generate an address and send funds to/from it without any issues.

Any help/info you can give would much appericated

Chris

Kexkey commented 4 years ago

Hi @chrisjmccreadie !

I am assuming you are using c-lightning 0.7.1. It's strange, I am using that version without any problem (cyphernode v0.2.4).

How many confirmations do you have on the funding transaction? You need to wait 6 confirmations (or is it 3 on testnet, I forgot?) on the funding transaction for the funds to be available to open LN channels.

At least the problem you have exists when you bypass cyphernode (via sparkwallet and clightning-cli), it means we can focus on c-lightning directly.

Can you have a look at clightning logs? Something like this should work:

docker logs `docker ps -q -f "name=cyphernode_lightning\."`
Kexkey commented 4 years ago

I just tested a fresh install on testnet and funds appear with listfunds even with only 2 confirmations... do you still have the problem?

chrisjmccreadie commented 4 years ago

yes. One thing I noticed is I get this sometimes when running start.sh/stop.sh

ERROR: for sparkwallet_cyphernode_sparkwallet_1 UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)

Not sure if it is related.

chrisjmccreadie commented 4 years ago

Logs for c-lightning

bitcoin ready! 2019-11-12T12:10:24.557Z lightningd(1): Waiting for bitcoind to warm up... 2019-11-12T12:11:04.752Z lightning_gossipd(17): We seem to be missing gossip messages 2019-11-12T12:11:04.831Z lightningd(1): -------------------------------------------------- 2019-11-12T12:11:04.831Z lightningd(1): Server started with public key 03a7e8b1edf3020bacca2ca0e5c8a6f8c52977e3362846c09097d02b7d9f63c077, alias ???? New Narwhal ???? (color #8c40bf) and lightningd v0.7.1 2019-11-12T12:11:05.139Z lightningd(1): bitcoin-cli: finished bitcoin-cli -testnet getblockhash 1057884 (18446744073709551609 ms) 2019-11-12T12:11:23.298Z lightningd(1): bitcoin-cli: finished bitcoin-cli -testnet getblockhash 1057901 (14874 ms) 2019-11-12T12:11:35.108Z lightningd(1): bitcoin-cli: finished bitcoin-cli -testnet getblock 0000000000001a749b7d2aabaf7f0c6c48441c021f13e3087c89682d37b06919 false (18446744073709551614 ms) 2019-11-12T12:11:56.158Z lightningd(1): bitcoin-cli: finished bitcoin-cli -testnet getblock 0000000000000c2b907197c64a362323ce8fe6dc459d41b06175103037ae9f06 false (18446744073709551345 ms) 2019-11-12T12:12:50.000Z lightningd(1): bitcoin-cli: finished bitcoin-cli -testnet getblock 000000006ea4f4cecf0e3e575f4e972b6036e5d261876a5df48e8a3f4abe0fd2 false (18446744073709551017 ms) 2019-11-12T12:14:11.092Z lightningd(1): bitcoin-cli: finished bitcoin-cli -testnet getblockhash 1059799 (18446744073709551279 ms) 2019-11-12T12:14:18.112Z lightningd(1): bitcoin-cli: finished bitcoin-cli -testnet getblockhash 1059850 (18446744073709551439 ms) 2019-11-12T12:15:51.008Z lightningd(1): bitcoin-cli: finished bitcoin-cli -testnet getblockhash 1060924 (18446744073709550654 ms) 2019-11-12T12:16:34.840Z lightningd(1): bitcoin-cli: finished bitcoin-cli -testnet getblockhash 1061454 (18446744073709551596 ms) 2019-11-12T12:17:04.819Z lightningd(1): bitcoin-cli: finished bitcoin-cli -testnet getblock 0000000000000310b29dcc8b2a951efa4f57a73c5fa9fc538df6c1327c3d201e false (18446744073709551602 ms)

chrisjmccreadie commented 4 years ago

here is the output from listfunds btw

Ruuning Listfunds: { "outputs" : [], "channels" : [] } data = { command: 'docker exec d2512d4c22e6 lightning-cli --lightning-dir=.lightning listfunds ', raw: '{\n "outputs" : [],\n "channels" : []\n}\n' }

chrisjmccreadie commented 4 years ago

The dev-listaddrs addresses show these addresses I created used the newaddr calls. Silly question time is there something that has to be fully synced like the bitcoin blockchain for Lightning as I noticed this in the c-lightning logs

bitcoin-cli: finished bitcoin-cli -testnet getblockhash 1110639 (14983 ms

and we are currently on block 1608118 on testnet 3?

chrisjmccreadie commented 4 years ago

I guess this is the issue as I now see in the get info there is a block height so when this is caught I assume I will see the funds.

Ruuning getinfo: { "id" : "03a7e8b1edf3020bacca2ca0e5c8a6f8c52977e3362846c09097d02b7d9f63c077", "alias" : "🚀 New Narwhal 🚀", "color" : "8c40bf", "num_peers" : 0, "num_pending_channels" : 0, "num_active_channels" : 0, "num_inactive_channels" : 0, "address" : [ { "type" : "ipv4", "address" : "127.0.0.1", "port" : 9735 } ], "binding" : [ { "type" : "ipv4", "address" : "0.0.0.0", "port" : 9735 } ], "version" : "v0.7.1", "blockheight" : 1258484, "network" : "testnet", "msatoshi_fees_collected" : 0, "fees_collected_msat" : "0msat" }

Kexkey commented 4 years ago

Yes, you have to be fully synced to see your latest transactions.

Let me know if it works! :)

chrisjmccreadie commented 4 years ago

gotcha, as usual, me being dumb. Thanks again for the quick response. Looks like I should be synced in a few hours I will let you know how it goes.

chrisjmccreadie commented 4 years ago

worked :]

image

FrancisPouliot commented 4 years ago

Glad it worked out!