mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-22 00:24:19 +01:00
pylightning: Fix the compat of txprepare
This commit is contained in:
@@ -891,7 +891,19 @@ class LightningRpc(UnixDomainSocketRpc):
|
|||||||
|
|
||||||
return self.call("withdraw", payload)
|
return self.call("withdraw", payload)
|
||||||
|
|
||||||
def txprepare(self, outputs, feerate=None, minconf=None, utxos=None):
|
def _deprecated_txprepare(self, destination, satoshi, feerate=None, minconf=None):
|
||||||
|
warnings.warn("txprepare now takes output arg: expect removal"
|
||||||
|
" in Mid-2020",
|
||||||
|
DeprecationWarning)
|
||||||
|
payload = {
|
||||||
|
"destination": destination,
|
||||||
|
"satoshi": satoshi,
|
||||||
|
"feerate": feerate,
|
||||||
|
"minconf": minconf,
|
||||||
|
}
|
||||||
|
return self.call("txprepare", payload)
|
||||||
|
|
||||||
|
def txprepare(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Prepare a bitcoin transaction which sends to [outputs].
|
Prepare a bitcoin transaction which sends to [outputs].
|
||||||
The format of output is like [{address1: amount1},
|
The format of output is like [{address1: amount1},
|
||||||
@@ -901,13 +913,22 @@ class LightningRpc(UnixDomainSocketRpc):
|
|||||||
Outputs will be reserved until you call txdiscard or txsend, or
|
Outputs will be reserved until you call txdiscard or txsend, or
|
||||||
lightningd restarts.
|
lightningd restarts.
|
||||||
"""
|
"""
|
||||||
payload = {
|
if 'destination' in kwargs or 'satoshi' in kwargs:
|
||||||
"outputs": outputs,
|
return self._deprecated_txprepare(*args, **kwargs)
|
||||||
"feerate": feerate,
|
|
||||||
"minconf": minconf,
|
if not isinstance(args[0], list):
|
||||||
"utxos": utxos,
|
return self._deprecated_txprepare(*args, **kwargs)
|
||||||
}
|
|
||||||
return self.call("txprepare", payload)
|
def _txprepare(outputs, feerate=None, minconf=None, utxos=None):
|
||||||
|
payload = {
|
||||||
|
"outputs": outputs,
|
||||||
|
"feerate": feerate,
|
||||||
|
"minconf": minconf,
|
||||||
|
"utxos": utxos,
|
||||||
|
}
|
||||||
|
return self.call("txprepare", payload)
|
||||||
|
|
||||||
|
return _txprepare(*args, **kwargs)
|
||||||
|
|
||||||
def txdiscard(self, txid):
|
def txdiscard(self, txid):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user