Skip to content

Add python integration test for spontaneous keysend payments#923

Merged
tnull merged 2 commits into
lightningdevkit:mainfrom
heyolaniran:feat/python_binding_test
Jun 24, 2026
Merged

Add python integration test for spontaneous keysend payments#923
tnull merged 2 commits into
lightningdevkit:mainfrom
heyolaniran:feat/python_binding_test

Conversation

@heyolaniran

Copy link
Copy Markdown
Contributor

Hello @tnull x @enigbe x @Camillarhi This commit adds the test_spontaneous_payment method which :

  • sets up two nodes in regtest environment, funds them, and opens channel
  • Arbitrary sends a 2.5M msat keysend with a custom TLV record
  • Asserts PAYMENT_SUCCESSFUL / PAYMENT_RECEIVED events
  • verify payment details Shared helpers (_setup_two_nodes, _fund_nodes, _open_channel_and_wait_ready, _stop_and_cleanup) reduce duplication for future integration

Motivation

The python bindings has not coverage for send_with_custom_tlvs

Run the new test

  • uv run --group dev python -m unittest src.ldk_node.test_ldk_node.TestLdkNode.test_spontaneous_payment -v

@ldk-reviews-bot

ldk-reviews-bot commented Jun 5, 2026

Copy link
Copy Markdown

👋 I see @tnull was un-assigned.
If you'd like another reviewer assignment, please click here.

@ldk-reviews-bot ldk-reviews-bot requested a review from tnull June 5, 2026 17:50
@ldk-reviews-bot

Copy link
Copy Markdown

🔔 1st Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@tnull tnull left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is currently not available, so we'll need to wait a bit. One comment for now

Comment thread bindings/python/src/ldk_node/test_ldk_node.py Outdated
@heyolaniran heyolaniran force-pushed the feat/python_binding_test branch from 0a308cb to 8056689 Compare June 8, 2026 18:31
@heyolaniran heyolaniran requested a review from tnull June 11, 2026 21:57
@ldk-reviews-bot

Copy link
Copy Markdown

🔔 1st Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

Comment thread bindings/python/src/ldk_node/test_ldk_node.py Outdated
Comment thread bindings/python/src/ldk_node/test_ldk_node.py
@heyolaniran heyolaniran force-pushed the feat/python_binding_test branch from 8056689 to 3c9be11 Compare June 15, 2026 17:23
@heyolaniran heyolaniran requested a review from tnull June 18, 2026 09:42
@ldk-reviews-bot

Copy link
Copy Markdown

🔔 1st Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 2nd Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@tnull tnull left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a rebase now, sorry!

@heyolaniran

Copy link
Copy Markdown
Contributor Author

@tnull fine, the conflit is resolved and i notice the CI is back !

@tnull tnull self-requested a review June 24, 2026 07:31
@tnull

tnull commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

@tnull fine, the conflit is resolved and i notice the CI is back !

Yes, please rebase now that #947 landed to get CI to pass.

@tnull tnull removed their request for review June 24, 2026 10:02
@heyolaniran

Copy link
Copy Markdown
Contributor Author

Yes, please rebase now that #947 landed to get CI to pass.

@tnull the branch is up to date and the CI passed successfully.

@tnull tnull left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please cleanup the commit history. It should just be two commits: first the prefactor extracting logic into the helper, then using the helper adding the new test case.

Please also make sure to follow the guidance on https://cbea.ms/git-commit/ for how to format/structure commit messages.

Duplicated node setup, funding, channel opening, and teardown logic
made integration tests harder to read and maintain. Hard-coded ports
also risked collisions when tests run in parallel.

Introduce reusable helpers for two-node setup, funding, channel
ready waiting, and cleanup. Bind ephemeral ports to avoid conflicts,
and refactor test_channel_full_cycle to use them without changing
test behavior.
Exercise the spontaneous payment (keysend) path through the Python
UniFFI bindings after a channel is ready. Assert events, custom TLV
records, and persisted payment metadata on both sender and receiver.
@heyolaniran heyolaniran force-pushed the feat/python_binding_test branch from 51df0ce to b318ccd Compare June 24, 2026 13:11
@heyolaniran

Copy link
Copy Markdown
Contributor Author

Please cleanup the commit history. It should just be two commits: first the prefactor extracting logic into the helper, then using the helper adding the new test case.

Please also make sure to follow the guidance on https://cbea.ms/git-commit/ for how to format/structure commit messages.

sure. history cleaned @tnull

@tnull tnull merged commit 8a54260 into lightningdevkit:main Jun 24, 2026
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants