From 01e0ba823252da3606a571c7bbd1b4cf8cdf6e8c Mon Sep 17 00:00:00 2001 From: lisa neigut Date: Tue, 3 Sep 2019 16:32:03 -0500 Subject: [PATCH] test: add check that withdraw's change is confirmed We're not tracking change outputs for withdraws, so they're not confirming. This test exposes the problem. --- tests/test_wallet.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/test_wallet.py b/tests/test_wallet.py index b2178754b..f007e052d 100644 --- a/tests/test_wallet.py +++ b/tests/test_wallet.py @@ -2,12 +2,13 @@ from decimal import Decimal from fixtures import * # noqa: F401,F403 from flaky import flaky # noqa: F401 from lightning import RpcError, Millisatoshi -from utils import only_one, wait_for +from utils import only_one, wait_for, sync_blockheight import pytest import time +@pytest.mark.xfail def test_withdraw(node_factory, bitcoind): amount = 1000000 # Don't get any funds from previous runs. @@ -44,6 +45,13 @@ def test_withdraw(node_factory, bitcoind): assert(withdrawal[0]['amount'] == Decimal('0.02')) + l1.bitcoin.generate_block(1) + sync_blockheight(l1.bitcoin, [l1]) + + # Check that there are no unconfirmed outputs (change should be confirmed) + for o in l1.rpc.listfunds()['outputs']: + assert o['status'] == 'confirmed' + # Now make sure two of them were marked as spent assert l1.db_query('SELECT COUNT(*) as c FROM outputs WHERE status=2')[0]['c'] == 2