Browse Source

add port argument in connect, add getpeer method for test convenience

ppa-0.6.1
gdassori 7 years ago
committed by Christian Decker
parent
commit
bdcf38442b
  1. 16
      contrib/pylightning/lightning/lightning.py

16
contrib/pylightning/lightning/lightning.py

@ -214,12 +214,13 @@ class LightningRpc(UnixDomainSocketRpc):
"""
return self._call("listpayments")
def connect(self, peer_id, host=None):
def connect(self, peer_id, host=None, port=None):
"""
Connect to {peer_id} at {host} (which can end in ':port' if not default)
Connect to {peer_id} at {host} and {port}
"""
args = [peer_id]
host is not None and args.append(host)
host and args.append(host)
port and args.append(port)
return self._call("connect", args=args)
def listpeers(self, peer_id=None, logs=None):
@ -230,6 +231,15 @@ class LightningRpc(UnixDomainSocketRpc):
logs is not None and args.append(logs)
return self._call("listpeers", args=args)
def getpeer(self, peer_id, logs=None):
"""
Show peer with {peer_id}, if {level} is set, include {log}s
"""
args = [peer_id]
logs is not None and args.append(logs)
res = self.listpeers(peer_id, logs)
return res.get('peers') and res['peers'][0]
def fundchannel(self, peer_id, satoshi):
"""
Fund channel with {id} using {satoshi} satoshis"

Loading…
Cancel
Save