Skip to content

Plugin isn't working properly #22

@dancingsushii

Description

@dancingsushii

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

I am now trying to execute this plugin 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions