Blockstream / greenlight

Build apps using self-custodial lightning nodes in the cloud
https://blockstream.github.io/greenlight/getting-started/
MIT License
109 stars 27 forks source link

Warning when starting a node: `warning_lightningd_sync: "Still loading latest blocks from bitcoind"` #392

Closed ilearnio closed 5 months ago

ilearnio commented 5 months ago

I'm trying to setup GleenLight by following the instructions here https://blockstream.github.io/greenlight/getting-started/schedule/, but I keep getting this warning when I am starting the node (using python script). It's there for more than a week already.

warning_lightningd_sync: "Still loading latest blocks from bitcoind."

image

Here's my node-start.py which results into an error:

from glclient import TlsConfig, Scheduler, Signer, clnpb

# Read seed from seed-secret.bin
with open('seed-secret.bin', 'rb') as f:
  seed = f.read()

# Read cert
with open('client.crt', 'r') as f:
  cert = f.read()

# Read key
with open('client-key.pem', 'r') as f:
  key = f.read()

# Creating a new `TlsConfig` object using your developer certificate
tls = TlsConfig().identity(cert, key)

signer = Signer(seed, network="bitcoin", tls=tls)
signer.run_in_thread()

# Read cert
with open('device-cert.crt', 'r') as f:
  cert = f.read()

# Read key
with open('device-key.pem', 'r') as f:
  key = f.read()

node_id = signer.node_id()
network = "bitcoin"
tls = TlsConfig().identity(cert, key)

scheduler = Scheduler(node_id, network, tls)
node = scheduler.node()

info = node.get_info()
peers = node.list_peers()

print(info)
print("peers:")
print(peers)

invoice = node.invoice(
    amount_msat=clnpb.AmountOrAny(any=True),
    label="label",
    description="description",
)

print("invoice:")
print(invoice)

Also, the process is hanging indefinitely at this line invoice = node.invoice(, not sure if that's intended

ErikDeSmedt commented 5 months ago

I'm currently working to reproduce the issue.

ErikDeSmedt commented 5 months ago

You can use the device-certificate for both the signer and the node. Could you try again with the following script?

from glclient import TlsConfig, Scheduler, Signer, clnpb

# Read seed from seed-secret.bin
with open('seed-secret.bin', 'rb') as f:
  seed = f.read()

# Read cert
with open('device-cert.crt', 'r') as f:
  cert = f.read()

# Read key
with open('device-key.pem', 'r') as f:
  key = f.read()

# Creating a new `TlsConfig` object using your developer certificate
tls = TlsConfig().identity(cert, key)

signer = Signer(seed, network="bitcoin", tls=tls)
signer.run_in_thread()

node_id = signer.node_id()
network = "bitcoin"
tls = TlsConfig().identity(cert, key)

scheduler = Scheduler(node_id, network, tls)
node = scheduler.node()

info = node.get_info()
peers = node.list_peers()

print(info)
print("peers:")
print(peers)

invoice = node.invoice(
    amount_msat=clnpb.AmountOrAny(any=True),
    label="some-label",
    description="description",
)

print("invoice:")
print(invoice)
ilearnio commented 5 months ago

Thanks @ErikDeSmedt. That seems to fix the hanging issue

image

However its still showing this:

warning_lightningd_sync: "Still loading latest blocks from bitcoind."
cdecker commented 5 months ago

Hi @ilearnio :wave:

The warning is normal and nothing to be concerned about. The nodes on Greenlight are started on demand, and, while we do start the nodes in the background to let them sync up with the blockchain, chances are that at the next time the user comes back there will almost always have been a new block, meaning the node is syncing again, and printing this warning. The warnign goes away after some minutes of running, and will reappear the next time the node is started.

As for the hanging issue, that is usually because you have issued a command requiring a signature (invoice signs the invocie with the node_id) and there is no signer currently connected. We are seeing a bit of flakiness in signer connections, which may also cause sporadic missing signers, but we are working on a fix for that too.