mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 14:24:09 +01:00
pylightning: interfaces for txprepare/txsend/txdiscard.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
985048edf8
commit
403b861fc7
1 changed files with 37 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue