ACINQ / eclair

A scala implementation of the Lightning Network.
Apache License 2.0
1.24k stars 266 forks source link

No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries #1263

Closed Concorde89 closed 4 years ago

Concorde89 commented 4 years ago

Use gettransaction for wallet transactions (code -5)

How to solve this?

t-bast commented 4 years ago

Is your Bitcoin core node correctly configured as detailed in our README? Looks like you didn't set txindex on it.

Concorde89 commented 4 years ago

txindex=1 this option is enabled in bitcoin core Also used the -txindex=1 when starting the node and that took e2 days to resync.

Concorde89 commented 4 years ago

2019-12-22 22:55:47,113 ERROR f.a.e.gui.FxPreloader - fr.acinq.eclair.blockchain.bitcoind.rpc.JsonRPCError: No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions. (code: -5)

t-bast commented 4 years ago

Are you sure Bitcoin Core wasn't still re-indexing when you launched your node? If so please share the startup logs from eclair and bitcoind, we don't have enough information to investigate. Can you post the output of bitcoin-cli's getblockchaininfo command as well?

Concorde89 commented 4 years ago

{ "chain": "main", "blocks": 609417, "headers": 609417, "bestblockhash": "000000000000000000118cdf750cc5800011ecb73b2aa0f0f4024d9a1b906b64", "difficulty": 12948593420946.38, "mediantime": 1577086620, "verificationprogress": 0.9999988737418566, "initialblockdownload": false, "chainwork": "00000000000000000000000000000000000000000b16e0e6db4b067304340674", "size_on_disk": 289390608776, "pruned": false, "softforks": { "bip34": { "type": "buried", "active": true, "height": 227931 }, "bip66": { "type": "buried", "active": true, "height": 363725 }, "bip65": { "type": "buried", "active": true, "height": 388381 }, "csv": { "type": "buried", "active": true, "height": 419328 }, "segwit": { "type": "buried", "active": true, "height": 481824 } }, "warnings": "" }

Concorde89 commented 4 years ago

2019-12-22 22:55:44,684 INFO a.e.slf4j.Slf4jLogger - Slf4jLogger started 2019-12-22 22:55:45,301 INFO fr.acinq.eclair.Setup - hello! 2019-12-22 22:55:45,302 INFO fr.acinq.eclair.Setup - version=0.3.2 commit=5ad3944e0221ba5a1b77039bdbaf94ee0a13aa44 2019-12-22 22:55:45,303 INFO fr.acinq.eclair.Setup - datadir=C:\Users\Goog.eclair 2019-12-22 22:55:45,304 INFO fr.acinq.eclair.Setup - initializing secure random generator 2019-12-22 22:55:45,534 INFO o.b.Secp256k1Context - secp256k1 library successfully loaded 2019-12-22 22:55:46,386 INFO fr.acinq.eclair.Setup - nodeid=0270d3d21429d0c61964c7dadd2c7c6edf1de30a826cf3e5f79dae50b77905ee12 alias=”Crypto Coffee LN” 2019-12-22 22:55:46,387 INFO fr.acinq.eclair.Setup - using chain=mainnet chainHash=6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 2019-12-22 22:55:47,113 ERROR f.a.e.gui.FxPreloader - fr.acinq.eclair.blockchain.bitcoind.rpc.JsonRPCError: No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions. (code: -5) at fr.acinq.eclair.blockchain.bitcoind.rpc.BasicBitcoinJsonRPCClient.jsonResponse2Exception(BasicBitcoinJsonRPCClient.scala:37) at fr.acinq.eclair.blockchain.bitcoind.rpc.BasicBitcoinJsonRPCClient$$anonfun$invoke$1.apply(BasicBitcoinJsonRPCClient.scala:34) at fr.acinq.eclair.blockchain.bitcoind.rpc.BasicBitcoinJsonRPCClient$$anonfun$invoke$1.apply(BasicBitcoinJsonRPCClient.scala:34) at scala.util.Success$$anonfun$map$1.apply(Try.scala:237) at scala.util.Try$.apply(Try.scala:192) at scala.util.Success.map(Try.scala:237) at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:237) at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:237) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:36) at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:121) at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.pollAndExecAll(ForkJoinPool.java:1253) at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1346) at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

t-bast commented 4 years ago

That's very strange I've never seen that before... We'll investigate and try to repro. Anything unusual about your bitcoind config that we should know about?

Concorde89 commented 4 years ago

bitcoin.conf listen=1 port=8333 maxconnections=30 server=1 rpcbind=localhost rpcuser=MYUSER rpcpassword=MYPASS rpcport=8332 keypool=100 txindex=1

reindex=1

zmqpubrawblock=tcp://127.0.0.1:29000 zmqpubrawtx=tcp://127.0.0.1:29000

addresstype=bech32

deprecatedrpc=signrawtransaction

Concorde89 commented 4 years ago

oh, and btw it is 0.19 /Satoshi:0.19.0.1/

t-bast commented 4 years ago

Have you re-started the Bitcoin Core node after the reindex operation completed? We did have reports from some people that Bitcoin Core 0.19 behaved strangely in that case, and usually a simple node restart fixed it.

Concorde89 commented 4 years ago

Just restarted again. Below you find the logs for eclair. 2019-12-23 00:37:40,834 INFO a.e.slf4j.Slf4jLogger - Slf4jLogger started 2019-12-23 00:37:41,457 INFO fr.acinq.eclair.Setup - hello! 2019-12-23 00:37:41,458 INFO fr.acinq.eclair.Setup - version=0.3.2 commit=5ad3944e0221ba5a1b77039bdbaf94ee0a13aa44 2019-12-23 00:37:41,459 INFO fr.acinq.eclair.Setup - datadir=C:\Users\Goog.eclair 2019-12-23 00:37:41,460 INFO fr.acinq.eclair.Setup - initializing secure random generator 2019-12-23 00:37:41,760 INFO o.b.Secp256k1Context - secp256k1 library successfully loaded 2019-12-23 00:37:42,440 INFO fr.acinq.eclair.Setup - nodeid=0270d3d21429d0c61964c7dadd2c7c6edf1de30a826cf3e5f79dae50b77905ee12 alias=”Crypto Coffee LN” 2019-12-23 00:37:42,441 INFO fr.acinq.eclair.Setup - using chain=mainnet chainHash=6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 2019-12-23 00:37:43,172 ERROR f.a.e.gui.FxPreloader - fr.acinq.eclair.blockchain.bitcoind.rpc.JsonRPCError: No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions. (code: -5) at fr.acinq.eclair.blockchain.bitcoind.rpc.BasicBitcoinJsonRPCClient.jsonResponse2Exception(BasicBitcoinJsonRPCClient.scala:37) at fr.acinq.eclair.blockchain.bitcoind.rpc.BasicBitcoinJsonRPCClient$$anonfun$invoke$1.apply(BasicBitcoinJsonRPCClient.scala:34) at fr.acinq.eclair.blockchain.bitcoind.rpc.BasicBitcoinJsonRPCClient$$anonfun$invoke$1.apply(BasicBitcoinJsonRPCClient.scala:34) at scala.util.Success$$anonfun$map$1.apply(Try.scala:237) at scala.util.Try$.apply(Try.scala:192) at scala.util.Success.map(Try.scala:237) at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:237) at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:237) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:36) at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:121) at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.pollAndExecAll(ForkJoinPool.java:1253) at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1346) at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

bitcoin conf was unchanged. logs from debug.log on bitcoin-qt has no errors. I am using jdk11

Concorde89 commented 4 years ago

eclair.chain=mainnet eclair.bitcoind.rpcport=8332 eclair.bitcoind.rpcuser=MYUSER eclair.bitcoind.rpcpassword=MYPASS eclair.node-alias=”Crypto Coffee LN” eclair.node-color=CC6600 eclair.bitcoind.zmq="tcp://127.0.0.1:29000"

Concorde89 commented 4 years ago

Should I try to run bitcoin-qt with the -txindex=1 option in the command line again?

t-bast commented 4 years ago

eclair.bitcoind.zmq="tcp://127.0.0.1:29000"

It looks like your eclair.conf is incorrect. This should be zmqblock and zmqtx (see our README). Not sure this would fix your problem but this needs to be fixed for the node to work.

I don't know if Bitcoin Core will behave correctly if txindex is only specified on the command-line (it will end up in a weird state if sometimes it runs with txindex on and sometimes it doesn't). It should be set to 1 once and for all in your bitcoin.conf (it looks like that's what you correctly did). Can you restart Bitcoin Core and Eclair after fixing your config and let me know what happens?

Concorde89 commented 4 years ago

Restarted bitcoin core Apllied modifications to eclair config file: eclair.chain=mainnet eclair.bitcoind.rpcport=8332 eclair.bitcoind.rpcuser=MYUSER eclair.bitcoind.rpcpassword=MYPASS eclair.node-alias=”Crypto Coffee LN” eclair.node-color=CC6600 eclair.bitcoind.zmqblock="tcp://127.0.0.1:29000" eclair.bitcoind.zmqtx="tcp://127.0.0.1:29000"

Started Eclair. same error.

t-bast commented 4 years ago

I can't repro this... It looks like an issue with your Bitcoin Core node's txindex. I'll ask around to see if I can find some guidance on what could go wrong with 0.19.

Concorde89 commented 4 years ago

Thanks. Will wait for your reply.

t-bast commented 4 years ago

@Concorde89 are you still experiencing this issue? I've spoken to a few people about that, and it does still look like an indexing issue on your bitcoin node. If you can repro, can you share the output of bitcoin-cli getrawtransaction 2157b554dcfda405233906e461ee593875ae4b1b97615872db6a25130ecc1dd6? Or with another recent transaction id?

Concorde89 commented 4 years ago

10:16:52  getrawtransaction 112b4126ba28df1d931c37907bbc70714011b1bbd2ab79cb2b991913aaabe0ca

10:16:52  No such mempool transaction. Use -txindex or provide a block hash to enable blockchain transaction queries. Use gettransaction for wallet transactions. (code -5)

It seems that something is wrong with the indexing indeed altough I have run the client with txindex -1 and it is configured into the conf file also.

t-bast commented 4 years ago

Yeah that confirms that the issue is with your bitcoin node's indexing... I'm not an expert on potential issues with bitcoin core's indexing, I didn't run into those yet. I'd suggest asking around on #bitcoin-wizards IRC or opening an issue on the bitcoin-core repository.

Concorde89 commented 4 years ago

Aftr reindexing the blocks on my hard drive again (an uninterrupted process that took 4 days) I am getting the same error. Maybe there is a problem with indexing on the 0.19.01. The getrawtransaction option does not work either. Any advice?

t-bast commented 4 years ago

I've never run into indexing problems like this with Bitcoin Core (usually a reindex and restart fixed all our users problems). Is there anything useful in the bitcoin logs that could help pinpoint the issue? Since the getrawtransaction RPC fails, you can probably ask for help on Bitcoin Core support, they will likely know better the internals of the re-indexing process and what could be failing...

Concorde89 commented 4 years ago

I have run the Bitcoin Core with the -txindex=1 flag. After checking the debug .log I've seen that it starded indexing tx. DO you know that if after this process is complete I have to run it every time with this flag and indexing all the tx all over again?

Once the txindex is complete, I will update you.

Here is the error I get now :  No such mempool transaction. Blockchain transactions are still in the process of being indexed. Use gettransaction for wallet transactions. (code -5)

A step forward.

Concorde89 commented 4 years ago

After indexing the tx by starting Bitcoin Core with -txindex=1 I got an error regarding the zmq parameters. I tried to restart the node with no flag and the indexing was not preserved. I will start it again with -txindex=1 and try to solve the zmq problem. Can you paste me a correct configuration for the smq parameters for the bitcoin.conf file and also for the eclair.conf file. Thanks.

t-bast commented 4 years ago

Blockchain transactions are still in the process of being indexed.

That's definitely progress! Once indexed, it won't need to re-index all the time. You do need to always provide txindex=1 in your config otherwise it will probably delete/recreate the index each time.

Can you paste me a correct configuration for the smq parameters for the bitcoin.conf file and also for the eclair.conf file.

If you use the configurations from our README, everything should work ok: https://github.com/acinq/eclair#Installation

Concorde89 commented 4 years ago

Ok. Reindexing is done. Elcair conf: eclair.chain=mainnet eclair.bitcoind.rpcport=8332 eclair.bitcoind.rpcuser=MYUSER eclair.bitcoind.rpcpassword=MYPASS eclair.node-alias=”Crypto Coffee LN” eclair.node-color=CC6600 eclair.bitcoind.zmqblock="tcp://127.0.0.1:29000" eclair.bitcoind.zmqtx="tcp://127.0.0.1:29000"

Bitcoin.conf: listen=1 port=8333 maxconnections=30 server=1 rpcbind=localhost rpcuser=MYUSER rpcpassword=MYPASS rpcport=8332 txindex=1 zmqpubrawblock=tcp://127.0.0.1:29000 zmqpubrawtx=tcp://127.0.0.1:29000

bitcoin daemon log 2020-01-19T13:04:39Z txindex is enabled at height 613550

eclair log 2020-01-19 05:15:39,405 INFO a.e.slf4j.Slf4jLogger - Slf4jLogger started 2020-01-19 05:15:41,140 INFO fr.acinq.eclair.Setup - hello! 2020-01-19 05:15:41,157 INFO fr.acinq.eclair.Setup - version=0.3.2 commit=5ad3944e0221ba5a1b77039bdbaf94ee0a13aa44 2020-01-19 05:15:41,165 INFO fr.acinq.eclair.Setup - datadir=C:\Users\Goog.eclair 2020-01-19 05:15:41,180 INFO fr.acinq.eclair.Setup - initializing secure random generator 2020-01-19 05:15:41,838 INFO o.b.Secp256k1Context - secp256k1 library successfully loaded 2020-01-19 05:15:43,481 INFO fr.acinq.eclair.Setup - nodeid=0270d3d21429d0c61964c7dadd2c7c6edf1de30a826cf3e5f79dae50b77905ee12 alias=”Crypto Coffee LN” 2020-01-19 05:15:43,506 INFO fr.acinq.eclair.Setup - using chain=mainnet chainHash=6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 2020-01-19 05:15:45,600 INFO fr.acinq.eclair.Setup - current feeratesPerKB=FeeratesPerKB(13661,13661,9762,3000,3000,3000,1000) feeratesPerKw=FeeratesPerKw(3415,3415,2440,750,750,750,253) 2020-01-19 05:15:46,040 INFO f.a.eclair.router.Router - loading network announcements from db... 2020-01-19 05:15:46,085 INFO f.a.eclair.router.Router - loaded from db: channels=0 nodes=0 2020-01-19 05:15:46,295 INFO f.a.eclair.router.Router - initialization completed, ready to process messages 2020-01-19 05:15:46,352 INFO fr.acinq.eclair.Setup - initial wallet address=334mD1xHVRJy7SziqtAbfc9ZUYdAUvQ9LS 2020-01-19 05:15:46,439 INFO f.a.e.io.Switchboard$ - htlcs_in=0 htlcs_out=0 htlcs_broken=0 2020-01-19 05:15:46,503 INFO f.acinq.eclair.io.Server - bound on /0:0:0:0:0:0:0:0:9735 2020-01-19 05:15:51,456 ERROR f.a.e.gui.FxPreloader - fr.acinq.eclair.BitcoinZMQConnectionTimeoutException$: could not connect to bitcoind using zeromq at fr.acinq.eclair.BitcoinZMQConnectionTimeoutException$.(Setup.scala) at fr.acinq.eclair.Setup$$anonfun$bootstrap$2$$anonfun$apply$16$$anonfun$apply$17$$anonfun$28.apply(Setup.scala:305) at fr.acinq.eclair.Setup$$anonfun$bootstrap$2$$anonfun$apply$16$$anonfun$apply$17$$anonfun$28.apply(Setup.scala:305) at akka.pattern.FutureTimeoutSupport$$anonfun$after$1.liftedTree1$1(FutureTimeoutSupport.scala:25) at akka.pattern.FutureTimeoutSupport$$anonfun$after$1.apply$mcV$sp(FutureTimeoutSupport.scala:25) at akka.actor.Scheduler$$anon$4.run(Scheduler.scala:126) at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:121) at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

** what is the initial wallet address? - "2020-01-19 05:15:46,352 INFO fr.acinq.eclair.Setup - initial wallet address=334mD1xHVRJy7SziqtAbfc9ZUYdAUvQ9LS" - my node is using bech32 addresses by default.

I have attached pictures with the error and the getrawtx result. error raw

Please advise.Tx.

t-bast commented 4 years ago

Did you compile bitcoind yourself? If you did, are you sure you enabled zeromq (see bitcoind's documentation on how to do that)?

Otherwise are you running bitcoind inside Docker? Anything special about how you run bitcoind and eclair that could explain why they have troubles connecting?

t-bast commented 4 years ago

Can you also verify that port 29000 is actually used? For example, sudo netstat -plnt | grep 29000?

Concorde89 commented 4 years ago

I run on a windows machine. Bitcoin Core was not compiled from sources. Port 29000 is not used when running netstat -aob without the ln running.

t-bast commented 4 years ago

Port 29000 is not used when running netstat -aob without the ln running.

That means there is an issue with bitcoind's ZeroMQ (which explains why eclair fails to connect to it). This may be windows-specific as I haven't had any issue with bitcoind's ZeroMQ on linux, let me try to find what could prevent it from working.

Concorde89 commented 4 years ago

Capture

t-bast commented 4 years ago

Let's remove the eclair part to troubleshoot the bitcoin ZeroMQ configuration. Can you run the following script (change the port to 29000 in line 37): https://github.com/bitcoin/bitcoin/blob/master/contrib/zmq/zmq_sub.py ?

t-bast commented 4 years ago

Please also double-check the bitcoin logs for entries related to ZeroMQ/zmq that could explain a failure to bind to port 29000.

Concorde89 commented 4 years ago

ok, After several attempts I have run the bitcoin core with "E:\Program Files\Bitcoin\bitcoin-qt.exe" -txindex=1 -zmqpubrawblock=tcp://127.0.0.1:29000 -zmqpubrawtx=tcp://127.0.0.1:29000 flags and the eclair showed. It seems my bitcoin core software is not reading the bitcoin.conf file. Maybe a problem with the software itself. Capture

What now?

t-bast commented 4 years ago

Great, it looks like all your problems have always been because Bitcoin didn't correctly locate your bitcoin.conf. Please double-check bitcoin's instructions on where to put the configuration file on Windows, that will probably solve many future issues.

I'm closing this ticket now as there are no issues with eclair itself.

Now that you have eclair running, you can open/close Lightning channels and send bitcoins over Lightning. Welcome to Lightning!