Skip to content

Commit 69a8ccc

Browse files
committed
pyln-client: create modern-style notifications if caller doesn't.
Signed-off-by: Rusty Russell <[email protected]>
1 parent 5d5741e commit 69a8ccc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

contrib/pyln-client/pyln/client/plugin.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import copy
12
import inspect
23
import io
34
import json
@@ -770,6 +771,12 @@ def _write_locked(self, obj: JSONType) -> None:
770771
self.stdout.flush()
771772

772773
def notify(self, method: str, params: JSONType) -> None:
774+
# Adapt old-style: wrap in method.
775+
if method not in params:
776+
new_params = copy.copy(params)
777+
new_params[method] = params
778+
params = new_params
779+
773780
payload = {
774781
'jsonrpc': '2.0',
775782
'method': method,

0 commit comments

Comments
 (0)