Skip to content

Expose PartialEq for ChannelMonitor #1913

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

Closed

Conversation

benthecarman
Copy link
Contributor

@benthecarman benthecarman commented Dec 12, 2022

Closes #1912

This would be the simplest way to accomplish this I believe, another idea could be use would be to use Ord and have it compare something like current_holder_commitment_number to see which is newer.

Copy link
Contributor

@wpaulino wpaulino left a comment

Choose a reason for hiding this comment

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

As is, this is missing some fields that need to be compared and were not included here. If we decide to expose this, we should also add a test so that we don't miss any fields added later on.

Alternatively, we could just expose a helper to determine whether two ChannelMonitors are for the same channel through their channel_keys_id. These must be unique as they are used in the key derivation per channel.

@benthecarman
Copy link
Contributor Author

As is, this is missing some fields that need to be compared and were not included here. If we decide to expose this, we should also add a test so that we don't miss any fields added later on.

Can do

Alternatively, we could just expose a helper to determine whether two ChannelMonitors are for the same channel through their channel_keys_id. These must be unique as they are used in the key derivation per channel.

I would like to use this to test that my storage is working correctly, doing this wouldn't really give guarantees that we are persisting things correctly

@TheBlueMatt
Copy link
Collaborator

If we want to remove the manual implementation, we probably can - we'll have to derive PartialEq/Eq for Events (which we should probably do generally anyway) and we'll have to move the Sign object out somehow. We could swap ChannelMonitorImpl for (Signer, ChannelMonitorImpl) or split it into two structs.

@benthecarman
Copy link
Contributor Author

Just gonna close this for now, thought it'd be a simple couple line change.

@benthecarman benthecarman deleted the partial-eq-channel-mon branch December 17, 2022 07:52
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.

Expose ChannelMonitor Eq
3 participants