From 9670b4382f7700f3d79aa9fa4530fdc9044e847a Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Tue, 22 Jan 2019 23:11:37 +0100 Subject: [PATCH] pylightning: Don't always use request ID 0 This isn't a problem for now since we don't support multithreading, and only allow synchronous calls, but eventually this'll become important. Signed-off-by: Christian Decker --- contrib/pylightning/lightning/lightning.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/pylightning/lightning/lightning.py b/contrib/pylightning/lightning/lightning.py index fd0c22ce3..779e45398 100644 --- a/contrib/pylightning/lightning/lightning.py +++ b/contrib/pylightning/lightning/lightning.py @@ -130,6 +130,7 @@ class UnixDomainSocketRpc(object): # Do we require the compatibility mode? self._compat = True + self.next_id = 0 def _writeobj(self, sock, obj): s = json.dumps(obj, cls=self.encoder) @@ -208,8 +209,9 @@ class UnixDomainSocketRpc(object): self._writeobj(sock, { "method": method, "params": payload, - "id": 0 + "id": self.next_id, }) + self.next_id += 1 resp, _ = self._readobj_compat(sock) sock.close()