Skip to content

Instantly share code, notes, and snippets.

@yuyaogawa
Created June 13, 2023 01:09
Show Gist options
  • Save yuyaogawa/487f88b9ee1996cc5b50245ff8396eb8 to your computer and use it in GitHub Desktop.
Save yuyaogawa/487f88b9ee1996cc5b50245ff8396eb8 to your computer and use it in GitHub Desktop.
from glclient import TlsConfig, Scheduler, Signer
seed=b'my-seed'
cert = "my-cert"
key = "my-key"
node_id = bytes.fromhex("02a5b6a3fe53c39edb348818b4a145c830db90cbc410ac52ce16e985e7f0b37e86")
network = "mainnet"
tls = TlsConfig()
tls = tls.identity(cert, key)
scheduler = Scheduler(node_id, network, tls)
node = scheduler.node()
signer = Signer(seed, network="mainnet", tls=tls)
signer.run_in_thread()
info = node.get_info()
print(info)
@yuyaogawa
Copy link
Author

yuyaogawa commented Jun 13, 2023

When I run this code I get this error.

Traceback (most recent call last):
  File "/root/glpy/mainnet.py", line 12, in <module>
    scheduler = Scheduler(node_id, network, tls)
  File "/usr/local/lib/python3.10/dist-packages/glclient/__init__.py", line 62, in __init__
    self.inner = native.Scheduler(node_id, network, tls.inner)
ValueError: Error parsing the network

But when I replace network option with testnet I get a response as follow.

id: "\002\245\266\243\376S\303\236\3334\210\030\264\241E\3100\333\220\313\304\020\254R\316\026\351\205\347\360\263~\206"
alias: "HOPPINGWHISPER-v23.05gl1"
color: "\002\245\266"
version: "v23.05gl1"
lightning_dir: "/tmp/bitcoin"
blockheight: 794114
network: "bitcoin"
fees_collected_msat {
}

I don't remember but I might called register with mainnet to register a node for the first time. Then my node was allocated as mainnet. But it seems weird since I have to call with testnet ever then for this instance.

@yuyaogawa
Copy link
Author

Wait... Actually I have to set network option to bitcoin for mainnet. That's why I got the error???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment