Skip to content

Impl clone for ChannelMonitor #2448

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
Jul 25, 2023

Conversation

TheBlueMatt
Copy link
Collaborator

This gives people more freedom with the channel monitors. For Mutiny this would be nice for us to be able to create copies of them and pass aorund in memory without having to serialize until we actually want to.

Originally by benthecarman benthecarman@live.com
Small bugfix from Matt Corallo git@bluematt.me

This is just the clone commit from #2331, the ord commit had some debate as to if it should just be a method, and the API for get_monitors was debated. Because at least the clone commit was nice, I figured we can just land this and leave the rest for if anyone else wants to do it.

This gives people more freedom with the channel monitors. For Mutiny
this would be nice for us to be able to create copies of them and pass
aorund in memory without having to serialize until we actually want to.

Originally by benthecarman <benthecarman@live.com>
Small bugfix from Matt Corallo <git@bluematt.me>
@@ -750,7 +750,14 @@ pub struct ChannelMonitor<Signer: WriteableEcdsaChannelSigner> {
pub(super) inner: Mutex<ChannelMonitorImpl<Signer>>,
}

#[derive(PartialEq)]
impl<Signer: WriteableEcdsaChannelSigner> Clone for ChannelMonitor<Signer> where Signer: Clone {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: just add a + Clone bound, or is there a difference?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They're equivalent, just gonna leave it the way it was in the original commit.

@codecov-commenter
Copy link

Codecov Report

Patch coverage: 77.77% and project coverage change: -0.03% ⚠️

Comparison is base (e13ff10) 90.24% compared to head (d026259) 90.21%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2448      +/-   ##
==========================================
- Coverage   90.24%   90.21%   -0.03%     
==========================================
  Files         106      106              
  Lines       55817    55833      +16     
  Branches    55817    55833      +16     
==========================================
+ Hits        50370    50371       +1     
- Misses       5447     5462      +15     
Files Changed Coverage Δ
lightning/src/chain/onchaintx.rs 90.75% <50.00%> (-2.31%) ⬇️
lightning/src/chain/channelmonitor.rs 94.67% <100.00%> (+<0.01%) ⬆️

... and 1 file with indirect coverage changes

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

@valentinewallace valentinewallace merged commit c6c684b into lightningdevkit:main Jul 25, 2023
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.

5 participants