Skip to content

Fix followups to PR2797 #2864

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

Merged
merged 1 commit into from
Feb 1, 2024
Merged

Conversation

dunxen
Copy link
Contributor

@dunxen dunxen commented Jan 31, 2024

Fixes requested for #2797.

Copy link

coderabbitai bot commented Jan 31, 2024

Walkthrough

The recent updates focus on streamlining the handling of monitor updates and channel IDs within the Lightning Network's codebase. By eliminating the need to explicitly pass channel IDs in various contexts and refining the usage of channel identifiers, these changes aim to simplify the code and potentially reduce errors. Additionally, adjustments in logging and event handling reflect a broader effort to enhance clarity and efficiency in the network's operation.

Changes

Files Change Summary
.../ln/channelmanager.rs Simplified monitor update handling by removing explicit channel_id parameters. Added channel_id to a struct.
.../ln/peer_handler.rs Removed DebugFundingChannelId import and usage, replaced with ChannelId::v1_from_funding_txid.
.../util/macro_logger.rs Removed unused imports and the DebugFundingChannelId struct.

"In the realm of code, where the rabbits tread,
Changes come swift, leaving old ways shed.
🌟 With every line refined, a new path we weave,
🚀 Towards simpler times, in what we believe."

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 5bf58f0 and 361079d.
Files selected for processing (3)
  • lightning/src/ln/channelmanager.rs (13 hunks)
  • lightning/src/ln/peer_handler.rs (2 hunks)
  • lightning/src/util/macro_logger.rs (2 hunks)
Files skipped from review due to trivial changes (1)
  • lightning/src/ln/peer_handler.rs
Additional comments: 16
lightning/src/util/macro_logger.rs (3)
  • 7-15: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [1-1]

The removal of OutPoint and Txid imports suggests these types are no longer used in this file. Ensure that this change does not affect any other parts of the code where these imports might be required.

  • 7-15: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [1-1]

The removal of the DebugFundingChannelId struct and its implementation aligns with the PR's objective to streamline channel identifier handling. Verify that no code segments are left referencing this struct, potentially leading to compile-time errors.

Verification successful

The executed script did not find any references to DebugFundingChannelId within the project. This suggests that the removal of the DebugFundingChannelId struct and its implementation has been handled properly, with no leftover references that could lead to compile-time errors.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for references to DebugFundingChannelId in the project.
rg "DebugFundingChannelId"

Length of output: 26

* 7-15: > 📝 **NOTE** > This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [1-1]

The remaining code, including macros and struct implementations for logging purposes, appears to be correctly implemented and adheres to best practices for clarity and maintainability. Ensure that the new logging structures and macros integrate well with the rest of the codebase, maintaining consistency and performance.

lightning/src/ln/channelmanager.rs (13)
  • 1636-1641: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [1-6]

The addition of channel_id: Option<ChannelId> to a structure is not shown in the provided code snippet. Ensure that the channel_id field is properly added and documented in the structure where funding_txo is defined.

  • 2296-2296: The macro handle_new_monitor_update! has been simplified by removing the $channel_id parameter. This change streamlines the process of handling monitor updates by relying solely on the $funding_txo. Ensure that all usages of this macro throughout the codebase have been updated accordingly to match the new signature.
  • 2753-2753: The call to handle_new_monitor_update! has been updated to remove the channel_id parameter, aligning with the macro's new signature. This change is consistent across multiple instances, simplifying the identification of channels during monitor updates.
  • 3414-3414: The call to handle_new_monitor_update! within a match statement has been updated to match the new macro signature by removing the channel_id parameter. This change is part of the broader effort to streamline monitor update handling.
  • 4770-4770: The call to handle_new_monitor_update! in the context of handling a funded channel has been updated to match the new macro signature. This change ensures consistency in how monitor updates are handled across different channel states.
  • 5574-5574: The call to handle_new_monitor_update! during a non-initialization phase has been updated to match the new macro signature. This change is part of the effort to ensure that monitor updates are handled consistently, regardless of the channel's initialization state.
  • 6570-6570: The call to handle_new_monitor_update! in the context of handling a shutdown script monitor update has been updated to match the new macro signature. This change is consistent with the overall simplification of monitor update handling.
  • 6852-6852: The call to handle_new_monitor_update! following a commitment_signed message handling has been updated to match the new macro signature. This change ensures that monitor updates are handled consistently across different channel operations.
  • 7031-7031: The call to handle_new_monitor_update! in the context of handling a monitor update after RAA (Revoke And Acknowledge) message processing has been updated to match the new macro signature. This change is part of the broader effort to streamline monitor update handling.
  • 7372-7372: The call to handle_new_monitor_update! in the context of handling a monitor update during a peer loop has been updated to match the new macro signature. This change ensures consistency in how monitor updates are processed across different channel interactions.
  • 8141-8141: The call to handle_new_monitor_update! for unlocking monitor updating for a channel has been updated to match the new macro signature. This change is consistent with the effort to simplify and unify the handling of monitor updates.
  • 9816-9816: The addition of required to the tuple associated with prev_channel_id in the deserialization process indicates a change in how prev_channel_id is handled. Ensure that this change is properly documented and that it aligns with the intended handling of channel identifiers during deserialization.
  • 11081-11081: The logging and handling of actions blocking RAA monitor updates have been updated to use the blocked_channel_id directly. This change is part of the broader effort to streamline and clarify the handling of monitor updates and their dependencies on channel states.

@codecov-commenter
Copy link

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (5bf58f0) 89.14% compared to head (361079d) 89.17%.

Files Patch % Lines
lightning/src/ln/channelmanager.rs 90.90% 1 Missing ⚠️
lightning/src/ln/peer_handler.rs 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2864      +/-   ##
==========================================
+ Coverage   89.14%   89.17%   +0.02%     
==========================================
  Files         116      116              
  Lines       93205    93201       -4     
  Branches    93205    93201       -4     
==========================================
+ Hits        83089    83109      +20     
+ Misses       7583     7566      -17     
+ Partials     2533     2526       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dunxen dunxen merged commit cc43f9c into lightningdevkit:main Feb 1, 2024
@dunxen dunxen deleted the 2024-01-2797followups branch February 1, 2024 08:19
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