Skip to content

util: Adds Into<PaymentHash> for PaymentPreimage - #2916

Merged
TheBlueMatt merged 1 commit into
lightningdevkit:mainfrom
sr-gi:2024-02-29-payment-preimage-hash
Feb 29, 2024
Merged

util: Adds Into<PaymentHash> for PaymentPreimage#2916
TheBlueMatt merged 1 commit into
lightningdevkit:mainfrom
sr-gi:2024-02-29-payment-preimage-hash

Conversation

@sr-gi

Copy link
Copy Markdown
Contributor

Currently, there is no way to build a PaymentHash from a PaymentPreimage (apart from doing it manually). This seems like a useful interface to have for downstream users.

@coderabbitai

coderabbitaiBot commented Feb 29, 2024

Copy link
Copy Markdown

Walkthrough

The update refines the import structure in lightning/src/ln/mod.rs, now utilizing Sha256 and Hash from bitcoin::hashes. Additionally, it implements the Into<PaymentHash> trait for PaymentPreimage, enabling seamless conversion to enhance payment processing capabilities.

Changes

File PathChange Summary
lightning/src/ln/mod.rsUpdated imports for Sha256 and Hash from bitcoin::hashes. Implemented Into<PaymentHash> for PaymentPreimage.

🐇✨
In the realm of code, where secrets hide,
New paths are forged, with hashes as guide.
From preimage to hash, a leap so bold,
A tale of transformation, gracefully told.
Through lines of change, our journey's spun,
In the glow of bytes, a new dawn begun.
🌟🐾

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.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

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: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between cfb4391 and 8c1ce0a.
Files selected for processing (1)
  • lightning/src/ln/mod.rs (3 hunks)
Additional comments: 1
lightning/src/ln/mod.rs (1)
  • 89-89: The imports from bitcoin::hashes are correctly added and used in the implementation of the Into<PaymentHash> trait for PaymentPreimage. This aligns with the PR objectives to facilitate the conversion between PaymentPreimage and PaymentHash.

Comment threadlightning/src/ln/mod.rs Outdated
#[cfg(not(fuzzing))]
pub(crate) mod channel;

use bitcoin::secp256k1::ThirtyTwoByteHash;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The import of ThirtyTwoByteHash from bitcoin::secp256k1 is added, but it appears to be unused in the provided code changes. Ensure that this import is necessary for the current implementation or future extensions. If it's not used, consider removing it to keep the code clean and maintainable.

Comment on lines +115 to +118
impl Into<PaymentHash> for PaymentPreimage {
fn into(self) -> PaymentHash {
PaymentHash(Sha256::hash(&self.0).into_32())
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The implementation of the Into<PaymentHash> trait for PaymentPreimage is concise and leverages the Sha256::hash function to perform the conversion. This is a straightforward and efficient way to achieve the desired functionality. However, consider adding documentation comments to explain the conversion process for future maintainers and users of the code. Enhancing documentation can significantly improve code readability and maintainability.

+ /// Converts a `PaymentPreimage` into a `PaymentHash` by hashing the preimage with SHA256.
impl Into<PaymentHash> for PaymentPreimage {
fn into(self) -> PaymentHash {
PaymentHash(Sha256::hash(&self.0).into_32())
}
}

Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
implInto<PaymentHash>forPaymentPreimage{
fn into(self) -> PaymentHash{
PaymentHash(Sha256::hash(&self.0).into_32())
}
/// Converts a `PaymentPreimage` into a `PaymentHash` by hashing the preimage with SHA256.
implInto<PaymentHash>forPaymentPreimage{
fn into(self) -> PaymentHash{
PaymentHash(Sha256::hash(&self.0).into_32())
}

@codecov-commenter

codecov-commenter commented Feb 29, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 89.30%. Comparing base (affe557) to head (8c1ce0a).
Report is 15 commits behind head on main.

❗ Current head 8c1ce0a differs from pull request most recent head d2ffcbc. Consider uploading reports for the commit d2ffcbc to get more accurate results

FilesPatch %Lines
lightning/src/ln/mod.rs0.00%3 Missing ⚠️

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

Additional details and impacted files
@@ Coverage Diff @@## main #2916 +/- ##
==========================================
+ Coverage 89.12% 89.30% +0.18% 
==========================================
Files 117 117 Lines 94456 96484 +2028 Branches 94456 96484 +2028 ==========================================
+ Hits 84180 86163 +1983 - Misses 7800 7868 +68 + Partials 2476 2453 -23 

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

This seems like a useful interface to have for downstream users
@sr-gi
sr-giforce-pushed the 2024-02-29-payment-preimage-hash branch from 8c1ce0a to d2ffcbcCompareFebruary 29, 2024 20:41

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

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 cfb4391 and d2ffcbc.
Files selected for processing (1)
  • lightning/src/ln/mod.rs (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • lightning/src/ln/mod.rs

@TheBlueMattTheBlueMatt 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.

Thanks!

@TheBlueMatt

Copy link
Copy Markdown
Collaborator

This is super trivial, it just hashes once...gonna go ahead and land this.

@TheBlueMatt
TheBlueMatt merged commit bf3bc42 into lightningdevkit:mainFeb 29, 2024
@tnull

tnull commented Mar 1, 2024

Copy link
Copy Markdown
Contributor

Post-merge nit: the std library docs state that implementing Into should be avoided:

One should avoid implementing Into and implement From instead. Implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.

Fixed in #2918.

@sr-gi

sr-gi commented Mar 1, 2024

Copy link
Copy Markdown
ContributorAuthor

Post-merge nit: the std library docs state that implementing Into should be avoided:

One should avoid implementing Into and implement From instead. Implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.

Fixed in #2918.

I always get this the other way around :/

Sign up for freeto 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

@sr-gi@codecov-commenter@TheBlueMatt@tnull
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
util: Adds Into<PaymentHash> for PaymentPreimage by sr-gi · Pull Request #2916 · lightningdevkit/rust-lightning · GitHub
Skip to content

util: Adds Into<PaymentHash> for PaymentPreimage - #2916

Merged
TheBlueMatt merged 1 commit into
lightningdevkit:mainfrom
sr-gi:2024-02-29-payment-preimage-hash
Feb 29, 2024
Merged

util: Adds Into<PaymentHash> for PaymentPreimage#2916
TheBlueMatt merged 1 commit into
lightningdevkit:mainfrom
sr-gi:2024-02-29-payment-preimage-hash

Conversation

@sr-gi

Copy link
Copy Markdown
Contributor

Currently, there is no way to build a PaymentHash from a PaymentPreimage (apart from doing it manually). This seems like a useful interface to have for downstream users.

@coderabbitai

coderabbitaiBot commented Feb 29, 2024

Copy link
Copy Markdown

Walkthrough

The update refines the import structure in lightning/src/ln/mod.rs, now utilizing Sha256 and Hash from bitcoin::hashes. Additionally, it implements the Into<PaymentHash> trait for PaymentPreimage, enabling seamless conversion to enhance payment processing capabilities.

Changes

File PathChange Summary
lightning/src/ln/mod.rsUpdated imports for Sha256 and Hash from bitcoin::hashes. Implemented Into<PaymentHash> for PaymentPreimage.

🐇✨
In the realm of code, where secrets hide,
New paths are forged, with hashes as guide.
From preimage to hash, a leap so bold,
A tale of transformation, gracefully told.
Through lines of change, our journey's spun,
In the glow of bytes, a new dawn begun.
🌟🐾

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.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

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: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between cfb4391 and 8c1ce0a.
Files selected for processing (1)
  • lightning/src/ln/mod.rs (3 hunks)
Additional comments: 1
lightning/src/ln/mod.rs (1)
  • 89-89: The imports from bitcoin::hashes are correctly added and used in the implementation of the Into<PaymentHash> trait for PaymentPreimage. This aligns with the PR objectives to facilitate the conversion between PaymentPreimage and PaymentHash.

Comment threadlightning/src/ln/mod.rs Outdated
#[cfg(not(fuzzing))]
pub(crate) mod channel;

use bitcoin::secp256k1::ThirtyTwoByteHash;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The import of ThirtyTwoByteHash from bitcoin::secp256k1 is added, but it appears to be unused in the provided code changes. Ensure that this import is necessary for the current implementation or future extensions. If it's not used, consider removing it to keep the code clean and maintainable.

Comment on lines +115 to +118
impl Into<PaymentHash> for PaymentPreimage {
fn into(self) -> PaymentHash {
PaymentHash(Sha256::hash(&self.0).into_32())
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The implementation of the Into<PaymentHash> trait for PaymentPreimage is concise and leverages the Sha256::hash function to perform the conversion. This is a straightforward and efficient way to achieve the desired functionality. However, consider adding documentation comments to explain the conversion process for future maintainers and users of the code. Enhancing documentation can significantly improve code readability and maintainability.

+ /// Converts a `PaymentPreimage` into a `PaymentHash` by hashing the preimage with SHA256.
impl Into<PaymentHash> for PaymentPreimage {
fn into(self) -> PaymentHash {
PaymentHash(Sha256::hash(&self.0).into_32())
}
}

Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
implInto<PaymentHash>forPaymentPreimage{
fn into(self) -> PaymentHash{
PaymentHash(Sha256::hash(&self.0).into_32())
}
/// Converts a `PaymentPreimage` into a `PaymentHash` by hashing the preimage with SHA256.
implInto<PaymentHash>forPaymentPreimage{
fn into(self) -> PaymentHash{
PaymentHash(Sha256::hash(&self.0).into_32())
}

@codecov-commenter

codecov-commenter commented Feb 29, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 89.30%. Comparing base (affe557) to head (8c1ce0a).
Report is 15 commits behind head on main.

❗ Current head 8c1ce0a differs from pull request most recent head d2ffcbc. Consider uploading reports for the commit d2ffcbc to get more accurate results

FilesPatch %Lines
lightning/src/ln/mod.rs0.00%3 Missing ⚠️

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

Additional details and impacted files
@@ Coverage Diff @@## main #2916 +/- ##
==========================================
+ Coverage 89.12% 89.30% +0.18% 
==========================================
Files 117 117 Lines 94456 96484 +2028 Branches 94456 96484 +2028 ==========================================
+ Hits 84180 86163 +1983 - Misses 7800 7868 +68 + Partials 2476 2453 -23 

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

This seems like a useful interface to have for downstream users
@sr-gi
sr-giforce-pushed the 2024-02-29-payment-preimage-hash branch from 8c1ce0a to d2ffcbcCompareFebruary 29, 2024 20:41

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

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 cfb4391 and d2ffcbc.
Files selected for processing (1)
  • lightning/src/ln/mod.rs (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • lightning/src/ln/mod.rs

@TheBlueMattTheBlueMatt 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.

Thanks!

@TheBlueMatt

Copy link
Copy Markdown
Collaborator

This is super trivial, it just hashes once...gonna go ahead and land this.

@TheBlueMatt
TheBlueMatt merged commit bf3bc42 into lightningdevkit:mainFeb 29, 2024
@tnull

tnull commented Mar 1, 2024

Copy link
Copy Markdown
Contributor

Post-merge nit: the std library docs state that implementing Into should be avoided:

One should avoid implementing Into and implement From instead. Implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.

Fixed in #2918.

@sr-gi

sr-gi commented Mar 1, 2024

Copy link
Copy Markdown
ContributorAuthor

Post-merge nit: the std library docs state that implementing Into should be avoided:

One should avoid implementing Into and implement From instead. Implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.

Fixed in #2918.

I always get this the other way around :/

Sign up for freeto 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

@sr-gi@codecov-commenter@TheBlueMatt@tnull
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' util: Adds Into<PaymentHash> for PaymentPreimage by sr-gi · Pull Request #2916 · lightningdevkit/rust-lightning · GitHub
Skip to content

util: Adds Into<PaymentHash> for PaymentPreimage - #2916

Merged
TheBlueMatt merged 1 commit into
lightningdevkit:mainfrom
sr-gi:2024-02-29-payment-preimage-hash
Feb 29, 2024
Merged

util: Adds Into<PaymentHash> for PaymentPreimage#2916
TheBlueMatt merged 1 commit into
lightningdevkit:mainfrom
sr-gi:2024-02-29-payment-preimage-hash

Conversation

@sr-gi

Copy link
Copy Markdown
Contributor

Currently, there is no way to build a PaymentHash from a PaymentPreimage (apart from doing it manually). This seems like a useful interface to have for downstream users.

@coderabbitai

coderabbitaiBot commented Feb 29, 2024

Copy link
Copy Markdown

Walkthrough

The update refines the import structure in lightning/src/ln/mod.rs, now utilizing Sha256 and Hash from bitcoin::hashes. Additionally, it implements the Into<PaymentHash> trait for PaymentPreimage, enabling seamless conversion to enhance payment processing capabilities.

Changes

File PathChange Summary
lightning/src/ln/mod.rsUpdated imports for Sha256 and Hash from bitcoin::hashes. Implemented Into<PaymentHash> for PaymentPreimage.

🐇✨
In the realm of code, where secrets hide,
New paths are forged, with hashes as guide.
From preimage to hash, a leap so bold,
A tale of transformation, gracefully told.
Through lines of change, our journey's spun,
In the glow of bytes, a new dawn begun.
🌟🐾

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.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

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: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between cfb4391 and 8c1ce0a.
Files selected for processing (1)
  • lightning/src/ln/mod.rs (3 hunks)
Additional comments: 1
lightning/src/ln/mod.rs (1)
  • 89-89: The imports from bitcoin::hashes are correctly added and used in the implementation of the Into<PaymentHash> trait for PaymentPreimage. This aligns with the PR objectives to facilitate the conversion between PaymentPreimage and PaymentHash.

Comment threadlightning/src/ln/mod.rs Outdated
#[cfg(not(fuzzing))]
pub(crate) mod channel;

use bitcoin::secp256k1::ThirtyTwoByteHash;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The import of ThirtyTwoByteHash from bitcoin::secp256k1 is added, but it appears to be unused in the provided code changes. Ensure that this import is necessary for the current implementation or future extensions. If it's not used, consider removing it to keep the code clean and maintainable.

Comment on lines +115 to +118
impl Into<PaymentHash> for PaymentPreimage {
fn into(self) -> PaymentHash {
PaymentHash(Sha256::hash(&self.0).into_32())
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The implementation of the Into<PaymentHash> trait for PaymentPreimage is concise and leverages the Sha256::hash function to perform the conversion. This is a straightforward and efficient way to achieve the desired functionality. However, consider adding documentation comments to explain the conversion process for future maintainers and users of the code. Enhancing documentation can significantly improve code readability and maintainability.

+ /// Converts a `PaymentPreimage` into a `PaymentHash` by hashing the preimage with SHA256.
impl Into<PaymentHash> for PaymentPreimage {
fn into(self) -> PaymentHash {
PaymentHash(Sha256::hash(&self.0).into_32())
}
}

Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
implInto<PaymentHash>forPaymentPreimage{
fn into(self) -> PaymentHash{
PaymentHash(Sha256::hash(&self.0).into_32())
}
/// Converts a `PaymentPreimage` into a `PaymentHash` by hashing the preimage with SHA256.
implInto<PaymentHash>forPaymentPreimage{
fn into(self) -> PaymentHash{
PaymentHash(Sha256::hash(&self.0).into_32())
}

@codecov-commenter

codecov-commenter commented Feb 29, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 89.30%. Comparing base (affe557) to head (8c1ce0a).
Report is 15 commits behind head on main.

❗ Current head 8c1ce0a differs from pull request most recent head d2ffcbc. Consider uploading reports for the commit d2ffcbc to get more accurate results

FilesPatch %Lines
lightning/src/ln/mod.rs0.00%3 Missing ⚠️

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

Additional details and impacted files
@@ Coverage Diff @@## main #2916 +/- ##
==========================================
+ Coverage 89.12% 89.30% +0.18% 
==========================================
Files 117 117 Lines 94456 96484 +2028 Branches 94456 96484 +2028 ==========================================
+ Hits 84180 86163 +1983 - Misses 7800 7868 +68 + Partials 2476 2453 -23 

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

This seems like a useful interface to have for downstream users
@sr-gi
sr-giforce-pushed the 2024-02-29-payment-preimage-hash branch from 8c1ce0a to d2ffcbcCompareFebruary 29, 2024 20:41

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

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 cfb4391 and d2ffcbc.
Files selected for processing (1)
  • lightning/src/ln/mod.rs (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • lightning/src/ln/mod.rs

@TheBlueMattTheBlueMatt 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.

Thanks!

@TheBlueMatt

Copy link
Copy Markdown
Collaborator

This is super trivial, it just hashes once...gonna go ahead and land this.

@TheBlueMatt
TheBlueMatt merged commit bf3bc42 into lightningdevkit:mainFeb 29, 2024
@tnull

tnull commented Mar 1, 2024

Copy link
Copy Markdown
Contributor

Post-merge nit: the std library docs state that implementing Into should be avoided:

One should avoid implementing Into and implement From instead. Implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.

Fixed in #2918.

@sr-gi

sr-gi commented Mar 1, 2024

Copy link
Copy Markdown
ContributorAuthor

Post-merge nit: the std library docs state that implementing Into should be avoided:

One should avoid implementing Into and implement From instead. Implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.

Fixed in #2918.

I always get this the other way around :/

Sign up for freeto 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

@sr-gi@codecov-commenter@TheBlueMatt@tnull
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' util: Adds Into<PaymentHash> for PaymentPreimage by sr-gi · Pull Request #2916 · lightningdevkit/rust-lightning · GitHub
Skip to content

util: Adds Into<PaymentHash> for PaymentPreimage - #2916

Merged
TheBlueMatt merged 1 commit into
lightningdevkit:mainfrom
sr-gi:2024-02-29-payment-preimage-hash
Feb 29, 2024
Merged

util: Adds Into<PaymentHash> for PaymentPreimage#2916
TheBlueMatt merged 1 commit into
lightningdevkit:mainfrom
sr-gi:2024-02-29-payment-preimage-hash

Conversation

@sr-gi

Copy link
Copy Markdown
Contributor

Currently, there is no way to build a PaymentHash from a PaymentPreimage (apart from doing it manually). This seems like a useful interface to have for downstream users.

@coderabbitai

coderabbitaiBot commented Feb 29, 2024

Copy link
Copy Markdown

Walkthrough

The update refines the import structure in lightning/src/ln/mod.rs, now utilizing Sha256 and Hash from bitcoin::hashes. Additionally, it implements the Into<PaymentHash> trait for PaymentPreimage, enabling seamless conversion to enhance payment processing capabilities.

Changes

File PathChange Summary
lightning/src/ln/mod.rsUpdated imports for Sha256 and Hash from bitcoin::hashes. Implemented Into<PaymentHash> for PaymentPreimage.

🐇✨
In the realm of code, where secrets hide,
New paths are forged, with hashes as guide.
From preimage to hash, a leap so bold,
A tale of transformation, gracefully told.
Through lines of change, our journey's spun,
In the glow of bytes, a new dawn begun.
🌟🐾

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.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

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: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between cfb4391 and 8c1ce0a.
Files selected for processing (1)
  • lightning/src/ln/mod.rs (3 hunks)
Additional comments: 1
lightning/src/ln/mod.rs (1)
  • 89-89: The imports from bitcoin::hashes are correctly added and used in the implementation of the Into<PaymentHash> trait for PaymentPreimage. This aligns with the PR objectives to facilitate the conversion between PaymentPreimage and PaymentHash.

Comment threadlightning/src/ln/mod.rs Outdated
#[cfg(not(fuzzing))]
pub(crate) mod channel;

use bitcoin::secp256k1::ThirtyTwoByteHash;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The import of ThirtyTwoByteHash from bitcoin::secp256k1 is added, but it appears to be unused in the provided code changes. Ensure that this import is necessary for the current implementation or future extensions. If it's not used, consider removing it to keep the code clean and maintainable.

Comment on lines +115 to +118
impl Into<PaymentHash> for PaymentPreimage {
fn into(self) -> PaymentHash {
PaymentHash(Sha256::hash(&self.0).into_32())
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The implementation of the Into<PaymentHash> trait for PaymentPreimage is concise and leverages the Sha256::hash function to perform the conversion. This is a straightforward and efficient way to achieve the desired functionality. However, consider adding documentation comments to explain the conversion process for future maintainers and users of the code. Enhancing documentation can significantly improve code readability and maintainability.

+ /// Converts a `PaymentPreimage` into a `PaymentHash` by hashing the preimage with SHA256.
impl Into<PaymentHash> for PaymentPreimage {
fn into(self) -> PaymentHash {
PaymentHash(Sha256::hash(&self.0).into_32())
}
}

Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
implInto<PaymentHash>forPaymentPreimage{
fn into(self) -> PaymentHash{
PaymentHash(Sha256::hash(&self.0).into_32())
}
/// Converts a `PaymentPreimage` into a `PaymentHash` by hashing the preimage with SHA256.
implInto<PaymentHash>forPaymentPreimage{
fn into(self) -> PaymentHash{
PaymentHash(Sha256::hash(&self.0).into_32())
}

@codecov-commenter

codecov-commenter commented Feb 29, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 89.30%. Comparing base (affe557) to head (8c1ce0a).
Report is 15 commits behind head on main.

❗ Current head 8c1ce0a differs from pull request most recent head d2ffcbc. Consider uploading reports for the commit d2ffcbc to get more accurate results

FilesPatch %Lines
lightning/src/ln/mod.rs0.00%3 Missing ⚠️

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

Additional details and impacted files
@@ Coverage Diff @@## main #2916 +/- ##
==========================================
+ Coverage 89.12% 89.30% +0.18% 
==========================================
Files 117 117 Lines 94456 96484 +2028 Branches 94456 96484 +2028 ==========================================
+ Hits 84180 86163 +1983 - Misses 7800 7868 +68 + Partials 2476 2453 -23 

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

This seems like a useful interface to have for downstream users
@sr-gi
sr-giforce-pushed the 2024-02-29-payment-preimage-hash branch from 8c1ce0a to d2ffcbcCompareFebruary 29, 2024 20:41

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

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 cfb4391 and d2ffcbc.
Files selected for processing (1)
  • lightning/src/ln/mod.rs (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • lightning/src/ln/mod.rs

@TheBlueMattTheBlueMatt 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.

Thanks!

@TheBlueMatt

Copy link
Copy Markdown
Collaborator

This is super trivial, it just hashes once...gonna go ahead and land this.

@TheBlueMatt
TheBlueMatt merged commit bf3bc42 into lightningdevkit:mainFeb 29, 2024
@tnull

tnull commented Mar 1, 2024

Copy link
Copy Markdown
Contributor

Post-merge nit: the std library docs state that implementing Into should be avoided:

One should avoid implementing Into and implement From instead. Implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.

Fixed in #2918.

@sr-gi

sr-gi commented Mar 1, 2024

Copy link
Copy Markdown
ContributorAuthor

Post-merge nit: the std library docs state that implementing Into should be avoided:

One should avoid implementing Into and implement From instead. Implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.

Fixed in #2918.

I always get this the other way around :/

Sign up for freeto 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

@sr-gi@codecov-commenter@TheBlueMatt@tnull
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' util: Adds Into<PaymentHash> for PaymentPreimage by sr-gi · Pull Request #2916 · lightningdevkit/rust-lightning · GitHub
Skip to content

util: Adds Into<PaymentHash> for PaymentPreimage - #2916

Merged
TheBlueMatt merged 1 commit into
lightningdevkit:mainfrom
sr-gi:2024-02-29-payment-preimage-hash
Feb 29, 2024
Merged

util: Adds Into<PaymentHash> for PaymentPreimage#2916
TheBlueMatt merged 1 commit into
lightningdevkit:mainfrom
sr-gi:2024-02-29-payment-preimage-hash

Conversation

@sr-gi

Copy link
Copy Markdown
Contributor

Currently, there is no way to build a PaymentHash from a PaymentPreimage (apart from doing it manually). This seems like a useful interface to have for downstream users.

@coderabbitai

coderabbitaiBot commented Feb 29, 2024

Copy link
Copy Markdown

Walkthrough

The update refines the import structure in lightning/src/ln/mod.rs, now utilizing Sha256 and Hash from bitcoin::hashes. Additionally, it implements the Into<PaymentHash> trait for PaymentPreimage, enabling seamless conversion to enhance payment processing capabilities.

Changes

File PathChange Summary
lightning/src/ln/mod.rsUpdated imports for Sha256 and Hash from bitcoin::hashes. Implemented Into<PaymentHash> for PaymentPreimage.

🐇✨
In the realm of code, where secrets hide,
New paths are forged, with hashes as guide.
From preimage to hash, a leap so bold,
A tale of transformation, gracefully told.
Through lines of change, our journey's spun,
In the glow of bytes, a new dawn begun.
🌟🐾

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.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

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: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between cfb4391 and 8c1ce0a.
Files selected for processing (1)
  • lightning/src/ln/mod.rs (3 hunks)
Additional comments: 1
lightning/src/ln/mod.rs (1)
  • 89-89: The imports from bitcoin::hashes are correctly added and used in the implementation of the Into<PaymentHash> trait for PaymentPreimage. This aligns with the PR objectives to facilitate the conversion between PaymentPreimage and PaymentHash.

Comment threadlightning/src/ln/mod.rs Outdated
#[cfg(not(fuzzing))]
pub(crate) mod channel;

use bitcoin::secp256k1::ThirtyTwoByteHash;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The import of ThirtyTwoByteHash from bitcoin::secp256k1 is added, but it appears to be unused in the provided code changes. Ensure that this import is necessary for the current implementation or future extensions. If it's not used, consider removing it to keep the code clean and maintainable.

Comment on lines +115 to +118
impl Into<PaymentHash> for PaymentPreimage {
fn into(self) -> PaymentHash {
PaymentHash(Sha256::hash(&self.0).into_32())
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The implementation of the Into<PaymentHash> trait for PaymentPreimage is concise and leverages the Sha256::hash function to perform the conversion. This is a straightforward and efficient way to achieve the desired functionality. However, consider adding documentation comments to explain the conversion process for future maintainers and users of the code. Enhancing documentation can significantly improve code readability and maintainability.

+ /// Converts a `PaymentPreimage` into a `PaymentHash` by hashing the preimage with SHA256.
impl Into<PaymentHash> for PaymentPreimage {
fn into(self) -> PaymentHash {
PaymentHash(Sha256::hash(&self.0).into_32())
}
}

Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
implInto<PaymentHash>forPaymentPreimage{
fn into(self) -> PaymentHash{
PaymentHash(Sha256::hash(&self.0).into_32())
}
/// Converts a `PaymentPreimage` into a `PaymentHash` by hashing the preimage with SHA256.
implInto<PaymentHash>forPaymentPreimage{
fn into(self) -> PaymentHash{
PaymentHash(Sha256::hash(&self.0).into_32())
}

@codecov-commenter

codecov-commenter commented Feb 29, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 89.30%. Comparing base (affe557) to head (8c1ce0a).
Report is 15 commits behind head on main.

❗ Current head 8c1ce0a differs from pull request most recent head d2ffcbc. Consider uploading reports for the commit d2ffcbc to get more accurate results

FilesPatch %Lines
lightning/src/ln/mod.rs0.00%3 Missing ⚠️

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

Additional details and impacted files
@@ Coverage Diff @@## main #2916 +/- ##
==========================================
+ Coverage 89.12% 89.30% +0.18% 
==========================================
Files 117 117 Lines 94456 96484 +2028 Branches 94456 96484 +2028 ==========================================
+ Hits 84180 86163 +1983 - Misses 7800 7868 +68 + Partials 2476 2453 -23 

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

This seems like a useful interface to have for downstream users
@sr-gi
sr-giforce-pushed the 2024-02-29-payment-preimage-hash branch from 8c1ce0a to d2ffcbcCompareFebruary 29, 2024 20:41

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

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 cfb4391 and d2ffcbc.
Files selected for processing (1)
  • lightning/src/ln/mod.rs (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • lightning/src/ln/mod.rs

@TheBlueMattTheBlueMatt 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.

Thanks!

@TheBlueMatt

Copy link
Copy Markdown
Collaborator

This is super trivial, it just hashes once...gonna go ahead and land this.

@TheBlueMatt
TheBlueMatt merged commit bf3bc42 into lightningdevkit:mainFeb 29, 2024
@tnull

tnull commented Mar 1, 2024

Copy link
Copy Markdown
Contributor

Post-merge nit: the std library docs state that implementing Into should be avoided:

One should avoid implementing Into and implement From instead. Implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.

Fixed in #2918.

@sr-gi

sr-gi commented Mar 1, 2024

Copy link
Copy Markdown
ContributorAuthor

Post-merge nit: the std library docs state that implementing Into should be avoided:

One should avoid implementing Into and implement From instead. Implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.

Fixed in #2918.

I always get this the other way around :/

Sign up for freeto 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

@sr-gi@codecov-commenter@TheBlueMatt@tnull
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' util: Adds Into<PaymentHash> for PaymentPreimage by sr-gi · Pull Request #2916 · lightningdevkit/rust-lightning · GitHub
Skip to content

util: Adds Into<PaymentHash> for PaymentPreimage - #2916

Merged
TheBlueMatt merged 1 commit into
lightningdevkit:mainfrom
sr-gi:2024-02-29-payment-preimage-hash
Feb 29, 2024
Merged

util: Adds Into<PaymentHash> for PaymentPreimage#2916
TheBlueMatt merged 1 commit into
lightningdevkit:mainfrom
sr-gi:2024-02-29-payment-preimage-hash

Conversation

@sr-gi

Copy link
Copy Markdown
Contributor

Currently, there is no way to build a PaymentHash from a PaymentPreimage (apart from doing it manually). This seems like a useful interface to have for downstream users.

@coderabbitai

coderabbitaiBot commented Feb 29, 2024

Copy link
Copy Markdown

Walkthrough

The update refines the import structure in lightning/src/ln/mod.rs, now utilizing Sha256 and Hash from bitcoin::hashes. Additionally, it implements the Into<PaymentHash> trait for PaymentPreimage, enabling seamless conversion to enhance payment processing capabilities.

Changes

File PathChange Summary
lightning/src/ln/mod.rsUpdated imports for Sha256 and Hash from bitcoin::hashes. Implemented Into<PaymentHash> for PaymentPreimage.

🐇✨
In the realm of code, where secrets hide,
New paths are forged, with hashes as guide.
From preimage to hash, a leap so bold,
A tale of transformation, gracefully told.
Through lines of change, our journey's spun,
In the glow of bytes, a new dawn begun.
🌟🐾

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.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

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: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between cfb4391 and 8c1ce0a.
Files selected for processing (1)
  • lightning/src/ln/mod.rs (3 hunks)
Additional comments: 1
lightning/src/ln/mod.rs (1)
  • 89-89: The imports from bitcoin::hashes are correctly added and used in the implementation of the Into<PaymentHash> trait for PaymentPreimage. This aligns with the PR objectives to facilitate the conversion between PaymentPreimage and PaymentHash.

Comment threadlightning/src/ln/mod.rs Outdated
#[cfg(not(fuzzing))]
pub(crate) mod channel;

use bitcoin::secp256k1::ThirtyTwoByteHash;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The import of ThirtyTwoByteHash from bitcoin::secp256k1 is added, but it appears to be unused in the provided code changes. Ensure that this import is necessary for the current implementation or future extensions. If it's not used, consider removing it to keep the code clean and maintainable.

Comment on lines +115 to +118
impl Into<PaymentHash> for PaymentPreimage {
fn into(self) -> PaymentHash {
PaymentHash(Sha256::hash(&self.0).into_32())
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The implementation of the Into<PaymentHash> trait for PaymentPreimage is concise and leverages the Sha256::hash function to perform the conversion. This is a straightforward and efficient way to achieve the desired functionality. However, consider adding documentation comments to explain the conversion process for future maintainers and users of the code. Enhancing documentation can significantly improve code readability and maintainability.

+ /// Converts a `PaymentPreimage` into a `PaymentHash` by hashing the preimage with SHA256.
impl Into<PaymentHash> for PaymentPreimage {
fn into(self) -> PaymentHash {
PaymentHash(Sha256::hash(&self.0).into_32())
}
}

Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
implInto<PaymentHash>forPaymentPreimage{
fn into(self) -> PaymentHash{
PaymentHash(Sha256::hash(&self.0).into_32())
}
/// Converts a `PaymentPreimage` into a `PaymentHash` by hashing the preimage with SHA256.
implInto<PaymentHash>forPaymentPreimage{
fn into(self) -> PaymentHash{
PaymentHash(Sha256::hash(&self.0).into_32())
}

@codecov-commenter

codecov-commenter commented Feb 29, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 89.30%. Comparing base (affe557) to head (8c1ce0a).
Report is 15 commits behind head on main.

❗ Current head 8c1ce0a differs from pull request most recent head d2ffcbc. Consider uploading reports for the commit d2ffcbc to get more accurate results

FilesPatch %Lines
lightning/src/ln/mod.rs0.00%3 Missing ⚠️

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

Additional details and impacted files
@@ Coverage Diff @@## main #2916 +/- ##
==========================================
+ Coverage 89.12% 89.30% +0.18% 
==========================================
Files 117 117 Lines 94456 96484 +2028 Branches 94456 96484 +2028 ==========================================
+ Hits 84180 86163 +1983 - Misses 7800 7868 +68 + Partials 2476 2453 -23 

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

This seems like a useful interface to have for downstream users
@sr-gi
sr-giforce-pushed the 2024-02-29-payment-preimage-hash branch from 8c1ce0a to d2ffcbcCompareFebruary 29, 2024 20:41

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

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 cfb4391 and d2ffcbc.
Files selected for processing (1)
  • lightning/src/ln/mod.rs (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • lightning/src/ln/mod.rs

@TheBlueMattTheBlueMatt 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.

Thanks!

@TheBlueMatt

Copy link
Copy Markdown
Collaborator

This is super trivial, it just hashes once...gonna go ahead and land this.

@TheBlueMatt
TheBlueMatt merged commit bf3bc42 into lightningdevkit:mainFeb 29, 2024
@tnull

tnull commented Mar 1, 2024

Copy link
Copy Markdown
Contributor

Post-merge nit: the std library docs state that implementing Into should be avoided:

One should avoid implementing Into and implement From instead. Implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.

Fixed in #2918.

@sr-gi

sr-gi commented Mar 1, 2024

Copy link
Copy Markdown
ContributorAuthor

Post-merge nit: the std library docs state that implementing Into should be avoided:

One should avoid implementing Into and implement From instead. Implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.

Fixed in #2918.

I always get this the other way around :/

Sign up for freeto 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

@sr-gi@codecov-commenter@TheBlueMatt@tnull
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); util: Adds Into<PaymentHash> for PaymentPreimage by sr-gi · Pull Request #2916 · lightningdevkit/rust-lightning · GitHub
Skip to content

util: Adds Into<PaymentHash> for PaymentPreimage - #2916

Merged
TheBlueMatt merged 1 commit into
lightningdevkit:mainfrom
sr-gi:2024-02-29-payment-preimage-hash
Feb 29, 2024
Merged

util: Adds Into<PaymentHash> for PaymentPreimage#2916
TheBlueMatt merged 1 commit into
lightningdevkit:mainfrom
sr-gi:2024-02-29-payment-preimage-hash

Conversation

@sr-gi

Copy link
Copy Markdown
Contributor

Currently, there is no way to build a PaymentHash from a PaymentPreimage (apart from doing it manually). This seems like a useful interface to have for downstream users.

@coderabbitai

coderabbitaiBot commented Feb 29, 2024

Copy link
Copy Markdown

Walkthrough

The update refines the import structure in lightning/src/ln/mod.rs, now utilizing Sha256 and Hash from bitcoin::hashes. Additionally, it implements the Into<PaymentHash> trait for PaymentPreimage, enabling seamless conversion to enhance payment processing capabilities.

Changes

File PathChange Summary
lightning/src/ln/mod.rsUpdated imports for Sha256 and Hash from bitcoin::hashes. Implemented Into<PaymentHash> for PaymentPreimage.

🐇✨
In the realm of code, where secrets hide,
New paths are forged, with hashes as guide.
From preimage to hash, a leap so bold,
A tale of transformation, gracefully told.
Through lines of change, our journey's spun,
In the glow of bytes, a new dawn begun.
🌟🐾

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.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

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: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between cfb4391 and 8c1ce0a.
Files selected for processing (1)
  • lightning/src/ln/mod.rs (3 hunks)
Additional comments: 1
lightning/src/ln/mod.rs (1)
  • 89-89: The imports from bitcoin::hashes are correctly added and used in the implementation of the Into<PaymentHash> trait for PaymentPreimage. This aligns with the PR objectives to facilitate the conversion between PaymentPreimage and PaymentHash.

Comment threadlightning/src/ln/mod.rs Outdated
#[cfg(not(fuzzing))]
pub(crate) mod channel;

use bitcoin::secp256k1::ThirtyTwoByteHash;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The import of ThirtyTwoByteHash from bitcoin::secp256k1 is added, but it appears to be unused in the provided code changes. Ensure that this import is necessary for the current implementation or future extensions. If it's not used, consider removing it to keep the code clean and maintainable.

Comment on lines +115 to +118
impl Into<PaymentHash> for PaymentPreimage {
fn into(self) -> PaymentHash {
PaymentHash(Sha256::hash(&self.0).into_32())
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The implementation of the Into<PaymentHash> trait for PaymentPreimage is concise and leverages the Sha256::hash function to perform the conversion. This is a straightforward and efficient way to achieve the desired functionality. However, consider adding documentation comments to explain the conversion process for future maintainers and users of the code. Enhancing documentation can significantly improve code readability and maintainability.

+ /// Converts a `PaymentPreimage` into a `PaymentHash` by hashing the preimage with SHA256.
impl Into<PaymentHash> for PaymentPreimage {
fn into(self) -> PaymentHash {
PaymentHash(Sha256::hash(&self.0).into_32())
}
}

Committable suggestion

‼️IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
implInto<PaymentHash>forPaymentPreimage{
fn into(self) -> PaymentHash{
PaymentHash(Sha256::hash(&self.0).into_32())
}
/// Converts a `PaymentPreimage` into a `PaymentHash` by hashing the preimage with SHA256.
implInto<PaymentHash>forPaymentPreimage{
fn into(self) -> PaymentHash{
PaymentHash(Sha256::hash(&self.0).into_32())
}

@codecov-commenter

codecov-commenter commented Feb 29, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 89.30%. Comparing base (affe557) to head (8c1ce0a).
Report is 15 commits behind head on main.

❗ Current head 8c1ce0a differs from pull request most recent head d2ffcbc. Consider uploading reports for the commit d2ffcbc to get more accurate results

FilesPatch %Lines
lightning/src/ln/mod.rs0.00%3 Missing ⚠️

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

Additional details and impacted files
@@ Coverage Diff @@## main #2916 +/- ##
==========================================
+ Coverage 89.12% 89.30% +0.18% 
==========================================
Files 117 117 Lines 94456 96484 +2028 Branches 94456 96484 +2028 ==========================================
+ Hits 84180 86163 +1983 - Misses 7800 7868 +68 + Partials 2476 2453 -23 

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

This seems like a useful interface to have for downstream users
@sr-gi
sr-giforce-pushed the 2024-02-29-payment-preimage-hash branch from 8c1ce0a to d2ffcbcCompareFebruary 29, 2024 20:41

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown

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 cfb4391 and d2ffcbc.
Files selected for processing (1)
  • lightning/src/ln/mod.rs (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • lightning/src/ln/mod.rs

@TheBlueMattTheBlueMatt 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.

Thanks!

@TheBlueMatt

Copy link
Copy Markdown
Collaborator

This is super trivial, it just hashes once...gonna go ahead and land this.

@TheBlueMatt
TheBlueMatt merged commit bf3bc42 into lightningdevkit:mainFeb 29, 2024
@tnull

tnull commented Mar 1, 2024

Copy link
Copy Markdown
Contributor

Post-merge nit: the std library docs state that implementing Into should be avoided:

One should avoid implementing Into and implement From instead. Implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.

Fixed in #2918.

@sr-gi

sr-gi commented Mar 1, 2024

Copy link
Copy Markdown
ContributorAuthor

Post-merge nit: the std library docs state that implementing Into should be avoided:

One should avoid implementing Into and implement From instead. Implementing From automatically provides one with an implementation of Into thanks to the blanket implementation in the standard library.

Fixed in #2918.

I always get this the other way around :/

Sign up for freeto 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

@sr-gi@codecov-commenter@TheBlueMatt@tnull