ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.83k stars 900 forks source link

`plugin-bcli` tries to process the same block and fails on the second try. #5662

Open somes731 opened 2 years ago

somes731 commented 2 years ago

Issue

plugin-bcli tries to process the same block and fails on the second try.

2022-10-16T17:19:02.294Z UNUSUAL plugin-bcli: bitcoin-cli: finished bitcoin-cli -testnet -rpcconnect=192.168.2.6 -rpcport=18332 -rpcuser=... -rpcpassword=... getblock 000000000000000e640fac4866087f3fdaf2f16dda989952b85f12d1b4636d47 0 (31647 ms) 

2022-10-16T17:19:02.294Z UNUSUAL plugin-bcli: bitcoin-cli -testnet -rpcconnect=192.168.2.6 -rpcport=18332 -rpcuser=... -rpcpassword=... getblock 000000000000000e640fac4866087f3fdaf2f16dda989952b85f12d1b4636d47 0 exited with status 1

getinfo output

Node is in status "Still loading latest blocks from bitcoind." forever.

{
   "id": "02ef919b00a4e13ec43e00f770a917208b4889148991db28ae239a36a8e9fe564c",
   "alias": "ZZ-node01",
   "color": "00ffb3",
   "num_peers": 5,
   "num_pending_channels": 0,
   "num_active_channels": 5,
   "num_inactive_channels": 0,
   "address": [],
   "binding": [
      {
         "type": "ipv4",
         "address": "192.168.2.11",
         "port": 7272
      }
   ],
   "version": "v0.12.1-modded",
   "blockheight": 0,
   "network": "testnet",
   "msatoshi_fees_collected": 42,
   "fees_collected_msat": "42msat",
   "lightning-dir": "/home/ilya/.lightningd/testnet",
   "warning_lightningd_sync": "Still loading latest blocks from bitcoind.",
   "our_features": {
      "init": "08a000080269a2",
      "node": "88a000080269a2",
      "channel": "",
      "invoice": "02000000024100"
   }
}
vincenzopalazzo commented 2 years ago

Yes, this is a bug, I and @swaptr reproduce it this summer, looks like the block are not updated in real-time!

evd0kim commented 1 year ago

Have the same error. With another block. Node fails to sync.

vincenzopalazzo commented 1 year ago

Can you provide some logs or stacktrace @evd0kim ?

evd0kim commented 1 year ago

@vincenzopalazzo yes

2023-03-07T17:46:07.376Z UNUSUAL plugin-bcli: bitcoin-cli: finished /home/ilya/Software/bitcoin-22.0/bin/bitcoin-cli -testnet -rpcconnect=192.168.2.6 -rpcport=18332 -rpcuser=... -stdinrpcpass getblock 00000000cbc6fd63a5c8bd64bfbc95aea3f628af1e492a8d9d741d294ae2f4e2 0 (32306 ms)
2023-03-07T17:46:07.376Z UNUSUAL plugin-bcli: /home/ilya/Software/bitcoin-22.0/bin/bitcoin-cli -testnet -rpcconnect=192.168.2.6 -rpcport=18332 -rpcuser=... -stdinrpcpass getblock 00000000cbc6fd63a5c8bd64bfbc95aea3f628af1e492a8d9d741d294ae2f4e2 0 exited with status 1

this error outputs during whole day.

vincenzopalazzo commented 1 year ago

what happens if you call the bitcoin command line with the input getblock 00000000cbc6fd63a5c8bd64bfbc95aea3f628af1e492a8d9d741d294ae2f4e2?

evd0kim commented 1 year ago

It shows block header info.

{
  "hash": "00000000cbc6fd63a5c8bd64bfbc95aea3f628af1e492a8d9d741d294ae2f4e2",
  "confirmations": 100,
  "height": 2423196,
  "version": 536870912,
  "versionHex": "20000000",
  "merkleroot": "1a66394443c77f4885d02dd010cdde2f6a9ded65745e0d98dd1ca9a39b7991a2",
  "time": 1678136900,
  "mediantime": 1678133208,
  "nonce": 2603886569,
  "bits": "1d00ffff",
  "difficulty": 1,
  "chainwork": "0000000000000000000000000000000000000000000009174a435133390b2ff9",
  "nTx": 3,
  "previousblockhash": "0000000082039ae70d4ee576efb71771457f6ef856fe3c990d4d27ebca69f633",
  "nextblockhash": "00000000000000338f4987ba3ee08fbc71c1f0cead1bf20ce326650a8b95edfd",
  "strippedsize": 493,
  "size": 993792,
  "weight": 995271,
  "tx": [
    "3506ac3e86fb9e48b5bb3f30d402ae9b29b77dab3d151c6f4485b9073e1357c1",
    "b90f8a3315c76077476a04e78bab04a25780c4fd2a2887c824694b6ed6132913",
    "91b8467d362a2a364dc405ab9497152ff5b4acfc366ad868dbbb9ff9fa28ccb9"
  ]
}

This is not a single block which causes errors.

evd0kim commented 1 year ago

@vincenzopalazzo could you suggest safe way to reset CLN peer? Like how to save only secret. I know that it provokes force-closes, I am on the testnet anyway.

evd0kim commented 1 year ago

Okay. Killing sqlite databases actually helped CLN to reach SYNC state. Now I will try alternatives to bcli to identify source of bugs as close as possible.

evd0kim commented 1 year ago

@vincenzopalazzo I am testing your btcli4j as an alternative to bcli. I think I couldn't get any results fast but this issue is opened since October 2022 so it doesn't really matter how fast I will get confirmation about bcli bug.

vincenzopalazzo commented 1 year ago

Yeah I think there is something wrong with this, but the issue happens sometimes and it is hard to reproduce :/

evd0kim commented 1 year ago

@vincenzopalazzo do you run testnet?

vincenzopalazzo commented 1 year ago

yep I had 3 node on testnet