cmdruid / cmdruid/regtest-workbench

Plugin isn't working properly

Open
#22 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
16
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Hi! First of all, many thanks for this useful project!

I am now trying to execute [this plugin](https://github.com/lightningd/plugins/tree/master/rebalance) on one of the spawned nodes with various channels and getting the following error:
```
{
"code": -32600,
"message": "Error while processing rebalanceall: int() argument must be a string, a bytes-like object or a number, not 'dict'",
"traceback": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.9/dist-packages/pyln/client/plugin.py\", line 639, in _dispatch_request\n result = self._exec_func(method.func, request)\n File \"/usr/local/lib/python3.9/dist-packages/pyln/client/plugin.py\", line 616, in _exec_func\n ret = func(*ba.args, **ba.kwargs)\n File \"/root/run/plugins/rebalance/rebalance.py\", line 677, in rebalanceall\n channels = get_open_channels(plugin)\n File \"/root/run/plugins/rebalance/rebalance.py\", line 415, in get_open_channels\n for peer in plugin.rpc.listpeers()[\"peers\"]:\n File \"/usr/local/lib/python3.9/dist-packages/pyln/client/lightning.py\", line 999, in listpeers\n return self.call(\"listpeers\", payload)\n File \"/usr/local/lib/python3.9/dist-packages/pyln/client/lightning.py\", line 384, in call\n resp, buf = self._readobj(sock, buf)\n File \"/usr/local/lib/python3.9/dist-packages/pyln/client/lightning.py\", line 312, in _readobj\n obj, _ = self.decoder.raw_decode(parts[0].decode(\"UTF-8\"))\n File \"/usr/lib/python3.9/json/decoder.py\", line 353, in raw_decode\n obj, end = self.scan_once(s, idx)\n File \"/usr/local/lib/python3.9/dist-packages/pyln/client/lightning.py\", line 494, in millisatoshi_hook\n obj = LightningRpc.LightningJSONDecoder.replace_amounts(obj)\n File \"/usr/local/lib/python3.9/dist-packages/pyln/client/lightning.py\", line 485, in replace_amounts\n obj[k] = Millisatoshi(v)\n File \"/usr/local/lib/python3.9/dist-packages/pyln/client/lightning.py\", line 70, in __init__\n elif int(v) == v:\nTypeError: int() argument must be a string, a bytes-like object or a number, not 'dict'\n"
}
```
I have previously used this plugin on both `testnet` and `mainnet` networks, and it worked fine. The plugin itself is installed correctly, I guess there's some kind of error in the environment?

The entry point is in this plugin call.

```
def get_open_channels(plugin: Plugin):
channels = []
for peer in plugin.rpc.listpeers()["peers"]:
for ch in peer["channels"]:
if ch["state"] == "CHANNELD_NORMAL" and not ch["private"]:
channels.append(ch)
return
```
And leads to this method in `lightning.py`

```
def listpeers(self, peerid=None, level=None):
"""
Show current peers, if {level} is set, include {log}s".
"""
payload = {
"id": peerid,
"level": level,
}
return self.call("listpeers", payload)
```

Thank you very much in advance for your help!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.