Browse Source

txprepare: don't crash on empty args

add test for empty args check
travis-debug
lisa neigut 5 years ago
committed by Christian Decker
parent
commit
1763960c4a
  1. 2
      contrib/pyln-client/pyln/client/lightning.py
  2. 2
      tests/test_wallet.py

2
contrib/pyln-client/pyln/client/lightning.py

@ -1069,7 +1069,7 @@ class LightningRpc(UnixDomainSocketRpc):
if 'destination' in kwargs or 'satoshi' in 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)
def _txprepare(outputs, feerate=None, minconf=None, utxos=None):

2
tests/test_wallet.py

@ -280,7 +280,7 @@ def test_txprepare(node_factory, bitcoind, chainparams):
bitcoind.generate_block(1)
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'])
assert decode['txid'] == prep['txid']
# 4 inputs, 2 outputs (3 if we have a fee output).

Loading…
Cancel
Save