Browse Source

pylightning: interfaces for txprepare/txsend/txdiscard.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
htlc_accepted_hook
Rusty Russell 5 years ago
parent
commit
403b861fc7
  1. 38
      contrib/pylightning/lightning/lightning.py

38
contrib/pylightning/lightning/lightning.py

@ -4,7 +4,7 @@ import logging
from math import floor, log10
import socket
__version__ = "0.0.7.1"
__version__ = "0.0.7.2"
class RpcError(ValueError):
@ -768,3 +768,39 @@ class LightningRpc(UnixDomainSocketRpc):
"minconf": minconf,
}
return self.call("withdraw", payload)
def txprepare(self, destination, satoshi, feerate=None, minconf=None):
"""
Prepare a bitcoin transaction which sends to {destination} address
{satoshi} (or "all") amount via Bitcoin transaction. Only select outputs
with {minconf} confirmations.
Outputs will be reserved until you call txdiscard or txsend, or
lightningd restarts.
"""
payload = {
"destination": destination,
"satoshi": satoshi,
"feerate": feerate,
"minconf": minconf,
}
return self.call("txprepare", payload)
def txdiscard(self, txid):
"""
Cancel a bitcoin transaction returned from txprepare. The outputs
it was spending are released for other use.
"""
payload = {
"txid": txid
}
return self.call("txdiscard", payload)
def txsend(self, txid):
"""
Sign and broadcast a bitcoin transaction returned from txprepare.
"""
payload = {
"txid": txid
}
return self.call("txsend", payload)

Loading…
Cancel
Save