-
Notifications
You must be signed in to change notification settings - Fork 471
Fix peer storage size cap to account for encryption overhead #4746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1952,7 +1952,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> { | |
| counterparty_hash_commitment_number: new_hash_map(), | ||
| counterparty_fulfilled_htlcs: new_hash_map(), | ||
|
|
||
| current_counterparty_commitment_number: 1 << 48, | ||
| current_counterparty_commitment_number: (1 << 48) - 1, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is in the production The original In normal operation the value is always overwritten by Recommend fixing this in
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ldk-claude-review-bot thanks for the thorough review. Point by point: 1. 2. Tightness of the cap — The math is intentional: 3. |
||
| current_holder_commitment_number, | ||
|
|
||
| payment_preimages: new_hash_map(), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd make sure this test tests right on the boundary. Currently it also passes if I manually set overhead to 0 again.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With 200 monitors the total serialized_length() was insufficient to reach the cap, so the test passed regardless of the overhead value. I've increased num_monitors to 600 and added a lower-bound assertion (msg.data.len() > MAX_PEER_STORAGE_SIZE - 500) to verify the boundary is actually exercised. Fixed in ff9c956.