mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
pyln: add datastore routines.
Without explicit definitions, we don't get proper names args and help messages. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
6939671a1b
commit
68f3e3fba9
@@ -603,6 +603,26 @@ class LightningRpc(UnixDomainSocketRpc):
|
|||||||
}
|
}
|
||||||
return self.call("connect", payload)
|
return self.call("connect", payload)
|
||||||
|
|
||||||
|
def datastore(self, key, string=None, hex=None, mode=None, generation=None):
|
||||||
|
"""
|
||||||
|
Add/replace an entry in the datastore; either string or hex.
|
||||||
|
{key} can be a single string, or a sequence of strings.
|
||||||
|
{mode} defaults to 'must-create', but other options are possible:
|
||||||
|
- 'must-replace': fail it it doesn't already exist.
|
||||||
|
- 'create-or-replace': don't fail.
|
||||||
|
- 'must-append': must exist, and append to existing.
|
||||||
|
- 'create-or-append': set, or append to existing.
|
||||||
|
{generation} only succeeds if the current entry has this generation count (mode must be 'must-replace' or 'must-append').
|
||||||
|
"""
|
||||||
|
payload = {
|
||||||
|
"key": key,
|
||||||
|
"string": string,
|
||||||
|
"hex": hex,
|
||||||
|
"mode": mode,
|
||||||
|
"generation": generation,
|
||||||
|
}
|
||||||
|
return self.call("datastore", payload)
|
||||||
|
|
||||||
def decodepay(self, bolt11, description=None):
|
def decodepay(self, bolt11, description=None):
|
||||||
"""
|
"""
|
||||||
Decode {bolt11}, using {description} if necessary.
|
Decode {bolt11}, using {description} if necessary.
|
||||||
@@ -613,6 +633,18 @@ class LightningRpc(UnixDomainSocketRpc):
|
|||||||
}
|
}
|
||||||
return self.call("decodepay", payload)
|
return self.call("decodepay", payload)
|
||||||
|
|
||||||
|
def deldatastore(self, key, generation=None):
|
||||||
|
"""
|
||||||
|
Remove an existing entry from the datastore.
|
||||||
|
{key} can be a single string, or a sequence of strings.
|
||||||
|
{generation} means delete only succeeds if the current entry has this generation count.
|
||||||
|
"""
|
||||||
|
payload = {
|
||||||
|
"key": key,
|
||||||
|
"generation": generation,
|
||||||
|
}
|
||||||
|
return self.call("deldatastore", payload)
|
||||||
|
|
||||||
def delexpiredinvoice(self, maxexpirytime=None):
|
def delexpiredinvoice(self, maxexpirytime=None):
|
||||||
"""
|
"""
|
||||||
Delete all invoices that have expired on or before the given {maxexpirytime}.
|
Delete all invoices that have expired on or before the given {maxexpirytime}.
|
||||||
@@ -943,6 +975,16 @@ class LightningRpc(UnixDomainSocketRpc):
|
|||||||
}
|
}
|
||||||
return self.call("listconfigs", payload)
|
return self.call("listconfigs", payload)
|
||||||
|
|
||||||
|
def listdatastore(self, key=None):
|
||||||
|
"""
|
||||||
|
Show entries in the heirarchical datastore, or just one from one {key}root.
|
||||||
|
{key} can be a single string, or a sequence of strings.
|
||||||
|
"""
|
||||||
|
payload = {
|
||||||
|
"key": key,
|
||||||
|
}
|
||||||
|
return self.call("listdatastore", payload)
|
||||||
|
|
||||||
def listforwards(self, status=None, in_channel=None, out_channel=None):
|
def listforwards(self, status=None, in_channel=None, out_channel=None):
|
||||||
"""List all forwarded payments and their information matching
|
"""List all forwarded payments and their information matching
|
||||||
forward {status}, {in_channel} and {out_channel}.
|
forward {status}, {in_channel} and {out_channel}.
|
||||||
|
|||||||
Reference in New Issue
Block a user