Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: NotATether on March 08, 2022, 06:34:24 AM



Title: BTCPayServer thinks that my BTC & c-lightning nodes are syncing forever.
Post by: NotATether on March 08, 2022, 06:34:24 AM
WooComerce checkout with BTCPayServer on my site is not working because of this ancient bug in the legacy BTCPayServer plugin (the new V2 plugin doesn't even work so I'm not using it): https://github.com/btcpayserver/woocommerce-plugin/issues/57

Quote
The error Sorry, but Bitcoin checkout with BTCPay does not appear to be working appears when:

Wallet is not configured
Server is still syncing
We should provide better error since it's been confusing users for a while now.

Also, the BTCPay dashboard says that my node is still syncing.

The problem here is, my Bitcoin node is fully synced so it should not be displaying that message (hence checkout should be working).

Bitcoin Core Version: 22.0
C-Lightning Version: 0.10.2
BTCPayServer Version: 1.4.7

Output from bitcoin-cli getblockchaininfo:

Code:
{
  "chain": "main",
  "blocks": 726371,
  "headers": 726371,
  "bestblockhash": "000000000000000000083122d3fe07cc349dd200d497891411a711cdb49375f7",
  "difficulty": 27550332084343.84,
  "mediantime": 1646716071,
  "verificationprogress": 0.9999973953887548,
  "initialblockdownload": false,
  "chainwork": "000000000000000000000000000000000000000029e42e12bcd83579d47bfe6c",
  "size_on_disk": 448072187188,
  "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
    },
    "taproot": {
      "type": "bip9",
      "bip9": {
        "status": "active",
        "start_time": 1619222400,
        "timeout": 1628640000,
        "since": 709632,
        "min_activation_height": 709632
      },
      "height": 709632,
      "active": true
    }
  },
  "warnings": ""
}

Output from lightning-cli getchaininfo:

Code:
{
   "chain": "main",
   "headercount": 726371,
   "blockcount": 726371,
   "ibd": false
}

Output from lightning-cli getinfo:
Code:
{
   "id": "03a464ea2e2edd4f174c68d6ed39972a41540baaef9649bfcbea4b288b37032bca",
   "alias": "ANGRYCHEF",
   "color": "03a464",
   "num_peers": 0,
   "num_pending_channels": 0,
   "num_active_channels": 0,
   "num_inactive_channels": 0,
   "address": [
      {
         "type": "ipv4",
         "address": "<redacted>", # IP address has been redacted for privacy reasons
         "port": 9735
      }
   ],
   "binding": [
      {
         "type": "ipv6",
         "address": "::",
         "port": 9735
      },
      {
         "type": "ipv4",
         "address": "0.0.0.0",
         "port": 9735
      }
   ],
   "version": "v0.10.2",
   "blockheight": 615434,
   "network": "bitcoin",
   "msatoshi_fees_collected": 0,
   "fees_collected_msat": "0msat",
   "lightning-dir": "/root/.lightning/bitcoin",
   "warning_lightningd_sync": "Still loading latest blocks from bitcoind."
}

Notice the last line in this output "warning_lightningd_sync": "Still loading latest blocks from bitcoind.". Why is c-lightning "still loading latest blocks" when Bitcoin Core has already  been fully synced since yesterday?

Also the LN blockheight is at 615434 ??? - I am not out of disk space.

EDIT: This guy had the exact same issue but with the default BTCPayServer on docker setup https://github.com/btcpayserver/btcpayserver-docker/issues/18


Title: Re: BTCPayServer thinks that my BTC & c-lightning nodes are syncing forever.
Post by: NeuroticFish on March 08, 2022, 08:30:12 AM
Also the LN blockheight is at 615434 ??? - I am not out of disk space.

EDIT: This guy had the exact same issue but with the default BTCPayServer on docker setup https://github.com/btcpayserver/btcpayserver-docker/issues/18

From what I've read/understood LN is using a pruned node and may be starting to check things too early.
BitcoinD at startup does check its last nodes and may be slow (especially if from HDD) <-- just a guess.
This issue to the one you've posted (https://github.com/ElementsProject/lightning/issues/1819) tells

Workaround: Using a utilities waiting for bitcoind to be fully synched before starting lnd. (Using NBXplorer/NBXplorer.NodeWaiter in BTCPay)

Maybe I'm completely off, but maybe it helps. I don't know. Good luck.


Title: Re: BTCPayServer thinks that my BTC & c-lightning nodes are syncing forever.
Post by: NotATether on March 08, 2022, 11:04:09 PM
@NeuroticFish turns out it had nothing to do with c-lightning this whole time, NBXplorer was not tracking any blocks because it was getting permission denied errors from Bitcoin Core's RPC, so I simply slapped

Code:
whitebind=127.0.0.1:8332
whitebind=127.0.0.1:8333

inside by bitcoin.conf, restarted Core, c-lightning, NBXplorer (don't forget to pass --btcstartheight=1 to reindex all the blocks), BTCPayServer itself, all that stuff and I was waiting for all that to sync.

c-lightning hasn't finished syncing yet (it's on block 700K something) but Bitcoin Core and NBXplorer has, there's no NBXplorer synchronizing notification anymore, and my Checkout page bloody works!

https://i.imgur.com/4Djij6s.png

I still want c-lightning to catch up so LN payments can be completely up to date. It's not exactly going snails pace but I think it will take a few more hours.

PS. I think I've found the reason why the new V2 Woocommerce plugin was not working at all - becuase something's literally broken inside the codebase (https://github.com/btcpayserver/woocommerce-greenfield-plugin).