Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLN plugin terminated on registertower when IP is provided #244

Open
seberm opened this issue Oct 12, 2023 · 3 comments
Open

CLN plugin terminated on registertower when IP is provided #244

seberm opened this issue Oct 12, 2023 · 3 comments
Labels
bug Something isn't working cln-plugin Stuff related to watchtower-plugin

Comments

@seberm
Copy link

seberm commented Oct 12, 2023

Hello,
I am running rust-teos v0.2.0. I am currently unable to test the latest master version.

It seems the watchtower plugin is crashing on tower registration when I provide the IP address instead of a hostname. The plugin is crashing when the values are provided as the separate arguments. If I provide the connection values in an URI format, everything works.

$ teos-cli gettowerinfo
{
  "tower_id": "037c5189943e296aca768436cc1613abe392bc857e82dcffc6bf0847e21fb14fa2",
  "n_registered_users": 1,
  "n_watcher_appointments": 0,
  "n_responder_trackers": 0,
  "bitcoind_reachable": true,
  "addresses": [
    {
      "type": "ipv4",
      "address": "127.0.0.1",
      "port": 9814
    }
  ]
}

$ lightning-cli registertower 037c5189943e296aca768436cc1613abe392bc857e82dcffc6bf0847e21fb14fa2 127.0.0.1 9814
{  
   "code": -4,
   "message": "Plugin terminated before replying to RPC call."
}

$ journalctl -u clightning | grep watch
Oct 12 18:37:32 nixos lightningd[17907]: INFO    plugin-watchtower-client: Starting retry manager
Oct 12 18:37:37 nixos lightningd[17907]: INFO    plugin-watchtower-client: Registering in the Eye of Satoshi (tower_id=037c5189943e296aca768436cc1613abe392bc857e82dcffc6bf0847e21fb14fa2)
Oct 12 18:37:37 nixos lightningd[17907]: INFO    plugin-watchtower-client: Registration succeeded. Available slots: 10000. Subscription period (block height range): (100-4420)
Oct 12 18:41:44 nixos lightningd[17907]: UNUSUAL plugin-watchtower-client: Plugin loop returned error Error reading command: failed to parse JSON
Oct 12 18:41:44 nixos lightningd[17907]: INFO    plugin-watchtower-client: Killing plugin: exited during normal operation

The workaround is to use the hostname instead of IP when providing values as multiple arguments or an URI (<tower_id>@<hostname>:<port>).

$ lightning-cli registertower 037c5189943e296aca768436cc1613abe392bc857e82dcffc6bf0847e21fb14fa2 localhost 9814
{
   "user_id": "035762660f40953731305866a536404431fbca8c416e198dccaaeb0459c23f2d9f",
   "available_slots": 40000,
   "subscription_start": 100,
   "subscription_expiry": 17380,
   "subscription_signature": "d7kw9sw68qxfbhubox537szu1ra13er7gg17tyrx4ke7dn33hwyqhitkc7gai97eygy8weq634jwff3pdb39qtrcsxx1oc55yt6nyace"
}
$ lightning-cli registertower 037c5189943e296aca768436cc1613abe392bc857e82dcffc6bf0847e21fb14fa2@127.0.0.1:9814
{
   "user_id": "035762660f40953731305866a536404431fbca8c416e198dccaaeb0459c23f2d9f",
   "available_slots": 30000,
   "subscription_start": 100,
   "subscription_expiry": 13060,
   "subscription_signature": "d6n9xnt36ugur4xk1c3od8sn3ukcqm8qigsfisjocjsscumfi6osggx9r6omsxkw4yh14eoxcr6jp1hroduseed4o1cpsczzn1zh6kny"
}

Wouldn't it be better to support only URI format for providing the connection values?

CC: @sr-gi

@sr-gi
Copy link
Member

sr-gi commented Oct 12, 2023

I've been taking a look at this and it looks like it is due to how the parameters are parsed from the terminal. This is before they are handed to us by the plugin manager, hence why it was not caught by our unit tests for the param parser.

The exact place where this fails, on cln-plugin, is: https://github.com/ElementsProject/lightning/blob/master/plugins/src/lib.rs#L625

I'm unsure though whether this is something that can be fixed on their end, or is something that depends on serde-json. I've been playing around a bit with things formatted like x.x... and they are a bit tricky. x.y would be interpreted as a float, whereas x.y.z seems to start being unhandled territory.

@sr-gi
Copy link
Member

sr-gi commented Oct 12, 2023

I'll need to dig deeper to see what the solution may entail, I guess for now using registertower with multiple inputs and an IP address should be disencouraged

@sr-gi sr-gi added bug Something isn't working cln-plugin Stuff related to watchtower-plugin labels Oct 12, 2023
@sr-gi
Copy link
Member

sr-gi commented Oct 18, 2023

This issue has been confirmed by the CLN devs.

Upstream ref: ElementsProject/lightning#6795

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cln-plugin Stuff related to watchtower-plugin
Projects
None yet
Development

No branches or pull requests

2 participants