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>
This commit is contained in:
Christian Decker 2019-01-22 23:11:37 +01:00 committed by Rusty Russell
parent f452d00b77
commit 9670b4382f

View File

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