Browse Source

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 <decker.christian@gmail.com>
pr-2355-addendum
Christian Decker 6 years ago
committed by Rusty Russell
parent
commit
9670b4382f
  1. 4
      contrib/pylightning/lightning/lightning.py

4
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()

Loading…
Cancel
Save