lightning: enable arbitrary arguments through json (over stdin)

This commit is contained in:
Janus 2018-02-13 11:15:28 +01:00
parent 3f069fb25f
commit 1cbb750e02

View File

@ -694,7 +694,7 @@ class Commands:
return sorted(known_commands.keys()) return sorted(known_commands.keys())
@command("wn") @command("wn")
def lightning(self, lcmd, *args): def lightning(self, lcmd, args=None):
q = queue.Queue() q = queue.Queue()
class FakeQtSignal: class FakeQtSignal:
def emit(self, data): def emit(self, data):
@ -702,6 +702,10 @@ class Commands:
class MyConsole: class MyConsole:
newResult = FakeQtSignal() newResult = FakeQtSignal()
self.wallet.lightning.setConsole(MyConsole()) self.wallet.lightning.setConsole(MyConsole())
if args:
args = json_decode(args)
else:
args = []
lightning.lightningCall(self.wallet.lightning, lcmd)(*args) lightning.lightningCall(self.wallet.lightning, lcmd)(*args)
return q.get(block=True, timeout=30) return q.get(block=True, timeout=30)