mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 15:44:21 +01:00
withdraw: fix incorrect error when we have an empty wallet.
This also highlights the danger of searching the logs: that error appeared previously in the logs, so we didn't notice that the actual withdraw call gave a different error. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -370,6 +370,8 @@ def test_withdraw(node_factory, bitcoind):
|
||||
l1.rpc.withdraw(waddr, 'not an amount')
|
||||
with pytest.raises(RpcError):
|
||||
l1.rpc.withdraw(waddr, -amount)
|
||||
with pytest.raises(RpcError, match=r'Cannot afford transaction'):
|
||||
l1.rpc.withdraw(waddr, amount * 100)
|
||||
|
||||
out = l1.rpc.withdraw(waddr, 2 * amount)
|
||||
|
||||
@@ -462,9 +464,8 @@ def test_withdraw(node_factory, bitcoind):
|
||||
assert l1.db_query('SELECT COUNT(*) as c FROM outputs WHERE status=0')[0]['c'] == 0
|
||||
|
||||
# This should fail, can't even afford fee.
|
||||
with pytest.raises(RpcError):
|
||||
with pytest.raises(RpcError, match=r'Cannot afford transaction'):
|
||||
l1.rpc.withdraw(waddr, 'all')
|
||||
l1.daemon.wait_for_log('Cannot afford transaction')
|
||||
|
||||
|
||||
def test_addfunds_from_block(node_factory, bitcoind):
|
||||
|
||||
Reference in New Issue
Block a user