mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
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.
This commit is contained in:
parent
4030ccf94c
commit
01e0ba8232
@ -2,12 +2,13 @@ from decimal import Decimal
|
|||||||
from fixtures import * # noqa: F401,F403
|
from fixtures import * # noqa: F401,F403
|
||||||
from flaky import flaky # noqa: F401
|
from flaky import flaky # noqa: F401
|
||||||
from lightning import RpcError, Millisatoshi
|
from lightning import RpcError, Millisatoshi
|
||||||
from utils import only_one, wait_for
|
from utils import only_one, wait_for, sync_blockheight
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.xfail
|
||||||
def test_withdraw(node_factory, bitcoind):
|
def test_withdraw(node_factory, bitcoind):
|
||||||
amount = 1000000
|
amount = 1000000
|
||||||
# Don't get any funds from previous runs.
|
# 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'))
|
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
|
# 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
|
assert l1.db_query('SELECT COUNT(*) as c FROM outputs WHERE status=2')[0]['c'] == 2
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user