daemon/lightningd: remove building, and main files

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-08-29 01:23:01 +09:30
committed by Christian Decker
parent 5db4e1144b
commit 88bb38f63b
68 changed files with 75 additions and 14951 deletions

View File

@@ -1 +1 @@
from .lightning import LightningRpc, LegacyLightningRpc
from .lightning import LightningRpc

View File

@@ -105,101 +105,6 @@ class LightningRpc(UnixDomainSocketRpc):
return self._call("dev-add-route", [src, dst, base, var, delay, minblocks])
class LegacyLightningRpc(UnixDomainSocketRpc):
def getchannels(self):
"""List all known channels.
"""
return self._call("getchannels", [])['channels']
def getnodes(self):
"""List all known nodes in the network.
"""
return self._call("getnodes", [])
def getlog(self, level=None):
"""Get logs, with optional level: [io|debug|info|unusual]
"""
return self._call("getlog", [level])
def getpeers(self):
"""Return a list of peers.
"""
return self._call("getpeers", [])
def getroute(self, destination, amount, riskfactor=1):
"""Return route to `destination` for `amount` milli satoshis, using `riskfactor`
"""
return self._call("getroute", [destination, amount, riskfactor])['route']
def getinfo(self):
"""Get general information about this node"""
return self._call("getinfo", [])
def invoice(self, amount, label, paymentKey=None):
"""Create a new invoice.
Create invoice for `amount` millisatoshi with
`label`. Optionally you can specify the `paymentKey`,
otherwise a random one will be generated. The `label` has to
be unique.
"""
args = [amount, label]
if paymentKey is not None:
args.append(paymentKey)
return self._call("invoice", args)
def waitinvoice(self, label=None, async=False):
"""Wait for the next invoice to be paid, after `label` (if supplied)
"""
args = []
if label is not None:
args.append(label)
def call():
return self._call("waitinvoice", args)
if async:
return self.executor.submit(call)
else:
return call()
def sendpay(self, route, paymenthash):
"""Send along `route` in return for preimage of `paymenthash`
"""
return self._call("sendpay", [route, paymenthash])
def pay(self, destination, amount, paymenthash):
"""Shorthand for `getroute` and `sendpay`
Sends `amount` millisatoshi to `destination` for invoice matching `paymenthash`
"""
route = self.getroute(destination, amount, 1)
return self.sendpay(route, paymenthash)
def dev_rhash(self, secret):
res = self._call("dev-rhash", [secret])
print(res)
return self._call("dev-rhash", [secret])['rhash']
def dev_newhtlc(self, peerid, amount, expiry, rhash):
return self._call("dev-newhtlc", [peerid, amount, expiry, rhash])
def dev_add_route(self, src, dst, base_fee, fee_rate, delay, minblocks):
return self._call("dev-add-route", [src, dst, base_fee, fee_rate, delay, minblocks])
def connect(self, hostname, port, fundingtxhex, async=False):
"""Connect to a `host` at `port` using `fundingtxhex` to fund
"""
def call_connect():
return self._call("connect", [hostname, port, fundingtxhex])
if not async:
return call_connect()
else:
return self.executor.submit(call_connect)
def newaddr(self):
"""Get a new address to fund a channel
"""
return self._call("newaddr", [])
if __name__ == "__main__":
l1 = LightningRpc("/tmp/lightning1/lightning-rpc")