Skip to content

Add tests and improve documentation for zero reserve channels#873

Open
tankyleo wants to merge 3 commits intolightningdevkit:mainfrom
tankyleo:2026-04-zero-reserve
Open

Add tests and improve documentation for zero reserve channels#873
tankyleo wants to merge 3 commits intolightningdevkit:mainfrom
tankyleo:2026-04-zero-reserve

Conversation

@tankyleo
Copy link
Copy Markdown
Contributor

Follow-up to #853

@ldk-reviews-bot
Copy link
Copy Markdown

ldk-reviews-bot commented Apr 11, 2026

👋 Thanks for assigning @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@tankyleo tankyleo requested review from benthecarman and tnull April 11, 2026 02:00
@tankyleo
Copy link
Copy Markdown
Contributor Author

Let me know how this sounds, is that the testing you had in mind ?

@benthecarman
Copy link
Copy Markdown
Contributor

benthecarman commented Apr 11, 2026

vss tests don't compile but yeah lgtm

@tankyleo tankyleo force-pushed the 2026-04-zero-reserve branch from d3e3e57 to f832421 Compare April 12, 2026 17:54
@tankyleo
Copy link
Copy Markdown
Contributor Author

Fixed the VSS tests, and reworked the documentation wording

@ldk-reviews-bot
Copy link
Copy Markdown

🔔 1st Reminder

Hey @tnull @benthecarman! 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.

1 similar comment
@ldk-reviews-bot
Copy link
Copy Markdown

🔔 1st Reminder

Hey @tnull @benthecarman! 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.

src/lib.rs Outdated
/// This channel allows the target node to try to steal your funds with no financial
/// penalty, so this channel should only be opened to nodes you trust.
/// The target node may have nothing at stake if it tries to steal your funds in this
/// channel, so only open this channel to nodes you trust.
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.

That 'only open this channel to nodes you trust' part is odd. There will only be one channel, there isn't the potential to open this one channel to multiple nodes/other nodes, just the one we're opening to...

FWIW, I preferred the previous version honestly.

@tankyleo tankyleo force-pushed the 2026-04-zero-reserve branch 3 times, most recently from 46ce6b3 to da6525a Compare April 13, 2026 17:35
@tankyleo
Copy link
Copy Markdown
Contributor Author

tankyleo commented Apr 13, 2026

Reverted comment to the previous version, and added some coverage on full channel balance sends.

@tankyleo tankyleo requested a review from tnull April 13, 2026 18:30
Copy link
Copy Markdown
Collaborator

@tnull tnull left a comment

Choose a reason for hiding this comment

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

Thanks!

Some more comments. Not quite sure about the doc changes yet. Tbh current version on main would be fine by me, but if we want to change them further, it should be a clear improvement.

src/lib.rs Outdated
///
/// This channel allows the target node to try to steal your funds with no financial
/// penalty, so this channel should only be opened to nodes you trust.
/// This channel allows the target node to try to steal your funds in that channel with no
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.

nit: Please avoid the 'this channel (..) that channel' duplication (here and below).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

right i think we wanted to clarify the target node cannot steal all your funds, just those in the channel you opened to that node.

src/liquidity.rs Outdated
/// balance. This allows clients to try to steal your funds with no financial penalty, so
/// this should only be set if you trust your clients.
/// When set, we will allow clients to spend their entire channel balance in the channels
/// we open to them. This allows clients to try to steal your funds in those channels with
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.

Maybe just say 'your channel balance' rather than funds, which should allow to drop the 'in those channels' part? (also note it should be 'which', not 'with' in the current version, but probably better to drop that altogether).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

you mean "which no financial penalty" ? not sure about that :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right hopefully with "channel balance", people understand this only applies to the funds they have in that particular channel, not the sum of all your channel balances across all your channels.

let node_a_outbound_capacity_msat = node_a.list_channels()[0].outbound_capacity_msat;
let node_a_reserve_msat =
node_a.list_channels()[0].unspendable_punishment_reserve.unwrap() * 1000;
// TODO: Update this for zero-fee commitment channels
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.

Mind opening an issue for this TODO, so we don't forget to actually address it. Could also be a bit more verbose, i.e., what are we waiting for exactly/what do we intend to update?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done here thank you

#875

@tankyleo tankyleo force-pushed the 2026-04-zero-reserve branch from da6525a to e3dd7a7 Compare April 14, 2026 16:43
@tankyleo tankyleo requested a review from tnull April 14, 2026 16:57
@tankyleo
Copy link
Copy Markdown
Contributor Author

Took your feedback tnull. If you'd rather drop the documentation commit let me know, I agree we should aim for clear improvements here.

@ldk-reviews-bot
Copy link
Copy Markdown

🔔 2nd Reminder

Hey @tnull @benthecarman! 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.

@tankyleo
Copy link
Copy Markdown
Contributor Author

I renamed the LSPS2ServiceConfig field to make it consistent with the current field in lightningdevkit/ldk-server#187

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.

4 participants