Skip to content

Commit

Permalink
add test for status_dlc
Browse files Browse the repository at this point in the history
  • Loading branch information
lollerfirst committed Aug 1, 2024
1 parent 10b6e9f commit 0da2683
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion tests/test_dlc.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,4 +388,29 @@ async def test_fund_same_dlc_twice_same_batch(wallet: Wallet, ledger: Ledger):
)
request = PostDlcRegistrationRequest(registrations=[dlc1, dlc2])
response = await ledger.register_dlc(request)
assert response.errors and len(response.errors) == 1, f"Funding proofs error: {response.errors[0].bad_inputs}"
assert response.errors and len(response.errors) == 1, f"Funding proofs error: {response.errors[0].bad_inputs}"

@pytest.mark.asyncio
async def test_get_dlc_status(wallet: Wallet, ledger: Ledger):
invoice = await wallet.request_mint(128)
await pay_if_regtest(invoice.bolt11)
minted = await wallet.mint(128, id=invoice.id)

dlc_root = sha256("TESTING".encode()).hexdigest()
dlc1 = DiscreetLogContract(
funding_amount=64,
unit="sat",
dlc_root=dlc_root,
inputs=minted,
)
request = PostDlcRegistrationRequest(registrations=[dlc1])
response = await ledger.register_dlc(request)
assert response.errors is None, f"Funding proofs error: {response.errors[0].bad_inputs}"
response = await ledger.status_dlc(dlc_root)
assert (
response.debts is None and
response.settled == False and
response.funding_amount == 128 and
response.unit == "sat",
f"GetDlcStatusResponse did not respect the format"
)

0 comments on commit 0da2683

Please sign in to comment.