mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 09:04:22 +01:00
txprepare: don't crash on empty args
add test for empty args check
This commit is contained in:
committed by
Christian Decker
parent
c2434ad4fb
commit
1763960c4a
@@ -1069,7 +1069,7 @@ class LightningRpc(UnixDomainSocketRpc):
|
|||||||
if 'destination' in kwargs or 'satoshi' in kwargs:
|
if 'destination' in kwargs or 'satoshi' in kwargs:
|
||||||
return self._deprecated_txprepare(*args, **kwargs)
|
return self._deprecated_txprepare(*args, **kwargs)
|
||||||
|
|
||||||
if not isinstance(args[0], list):
|
if len(args) and not isinstance(args[0], list):
|
||||||
return self._deprecated_txprepare(*args, **kwargs)
|
return self._deprecated_txprepare(*args, **kwargs)
|
||||||
|
|
||||||
def _txprepare(outputs, feerate=None, minconf=None, utxos=None):
|
def _txprepare(outputs, feerate=None, minconf=None, utxos=None):
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ def test_txprepare(node_factory, bitcoind, chainparams):
|
|||||||
bitcoind.generate_block(1)
|
bitcoind.generate_block(1)
|
||||||
wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == 10)
|
wait_for(lambda: len(l1.rpc.listfunds()['outputs']) == 10)
|
||||||
|
|
||||||
prep = l1.rpc.txprepare([{addr: Millisatoshi(amount * 3 * 1000)}])
|
prep = l1.rpc.txprepare(outputs=[{addr: Millisatoshi(amount * 3 * 1000)}])
|
||||||
decode = bitcoind.rpc.decoderawtransaction(prep['unsigned_tx'])
|
decode = bitcoind.rpc.decoderawtransaction(prep['unsigned_tx'])
|
||||||
assert decode['txid'] == prep['txid']
|
assert decode['txid'] == prep['txid']
|
||||||
# 4 inputs, 2 outputs (3 if we have a fee output).
|
# 4 inputs, 2 outputs (3 if we have a fee output).
|
||||||
|
|||||||
Reference in New Issue
Block a user