-
Notifications
You must be signed in to change notification settings - Fork 402
Pre-C Bindings Cleanup #620
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
Pre-C Bindings Cleanup #620
Conversation
cd8520e
to
8f23cf4
Compare
Codecov Report
@@ Coverage Diff @@
## master #620 +/- ##
==========================================
+ Coverage 91.29% 91.35% +0.06%
==========================================
Files 35 35
Lines 20776 20775 -1
==========================================
+ Hits 18967 18979 +12
+ Misses 1809 1796 -13
Continue to review full report at Codecov.
|
/// The concrete type which signs for transactions and provides access to our channel public | ||
/// keys. | ||
type Keys: ChannelKeys; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/which/that
Or how about simply "Keys needed to operate the monitored channels."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're slowly moving away from it being keys and more towards it being an interface which signs for things (eg a hardware wallet).
5b81cc6
to
1523501
Compare
This makes it easier for our automated bindings generator to function as it tries to automatically create a ::new if the struct contains only pub elements who's type is convertible.
Looks good but needs rebase |
1523501
to
7411aad
Compare
@@ -172,41 +174,105 @@ impl events::MessageSendEventsProvider for TestChannelMessageHandler { | |||
} | |||
} | |||
|
|||
fn get_dummy_channel_announcement(short_chan_id: u64) -> msgs::ChannelAnnouncement { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test helpers move could have been commented in commit or at least splitted to ease review. That's okay AFAICT, they don't break anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just commented it in the commit.
Instead of using a raw generic type, an associted type allows us to have explicit docs on the type, which is nice. More importantly, however, our automated bindings generator knows how to read associated types but not raw generics. Also, our bindings generator expects things which are referenced to have already been defined, so we move ManyChannelMonitor below the ChannelMonitor definition.
We also update to use single idents when referencing the Deref=* types since the automated code generator is pretty braindead. This also moves some test utils out of peer_handler.rs and into util::test_utils to standardize things a little bit, which we need to concretize the PeerHandler types used in testing.
We never actually fail, so we can just drop the Result type.
* Return Self instead of the fully-written types for constructors, * Place definitions before use (in this case for KeysInterface), * Don't import foo::bar::self, but import foo::bar + a spelling fix in the KeysInterface docs for get_onion_rand.
Its just a trivial bool and already has docs on it, so seems like an oversight
7411aad
to
ba06507
Compare
Gonna take this since we already did the review cycles, but there will be more before bindings land. |
This is some of the groundwork needed for #618, but which is generally applicable. Most of the cleanups are also slightly cleaner code, so easy to land this before.