mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
contrib/pyln-client: allow lightningd to give us non-numeric ids.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -72,7 +72,7 @@ class RpcException(Exception):
|
|||||||
class Request(dict):
|
class Request(dict):
|
||||||
"""A request object that wraps params and allows async return
|
"""A request object that wraps params and allows async return
|
||||||
"""
|
"""
|
||||||
def __init__(self, plugin: 'Plugin', req_id: Optional[int], method: str,
|
def __init__(self, plugin: 'Plugin', req_id: Optional[str], method: str,
|
||||||
params: Any, background: bool = False):
|
params: Any, background: bool = False):
|
||||||
self.method = method
|
self.method = method
|
||||||
self.params = params
|
self.params = params
|
||||||
@@ -700,13 +700,9 @@ class Plugin(object):
|
|||||||
request.progress(progress, progress_total, stage, stage_total)
|
request.progress(progress, progress_total, stage, stage_total)
|
||||||
|
|
||||||
def _parse_request(self, jsrequest: Dict[str, JSONType]) -> Request:
|
def _parse_request(self, jsrequest: Dict[str, JSONType]) -> Request:
|
||||||
i = jsrequest.get('id', None)
|
|
||||||
if not isinstance(i, int) and i is not None:
|
|
||||||
raise ValueError('Non-integer request id "{i}"'.format(i=i))
|
|
||||||
|
|
||||||
request = Request(
|
request = Request(
|
||||||
plugin=self,
|
plugin=self,
|
||||||
req_id=i,
|
req_id=jsrequest.get('id', None),
|
||||||
method=str(jsrequest['method']),
|
method=str(jsrequest['method']),
|
||||||
params=jsrequest['params'],
|
params=jsrequest['params'],
|
||||||
background=False,
|
background=False,
|
||||||
|
|||||||
Reference in New Issue
Block a user