Expose temporary channel ID and user channel ID pre-funding#1121
Expose temporary channel ID and user channel ID pre-funding#1121TheBlueMatt merged 3 commits intolightningdevkit:mainfrom
Conversation
This makes it more practical for users to track channels prior to funding, especially if the channel fails because the peer rejects it for a parameter mismatch.
This makes it more practical for users to track channels using their own IDs, especially across funding.
Codecov Report
@@ Coverage Diff @@
## main #1121 +/- ##
==========================================
+ Coverage 90.67% 91.83% +1.16%
==========================================
Files 66 66
Lines 34732 39174 +4442
==========================================
+ Hits 31492 35977 +4485
+ Misses 3240 3197 -43
Continue to review full report at Codecov.
|
arik-so
left a comment
There was a problem hiding this comment.
If we're gonna keep a user id around, it might be helpful to have the abilitty to set a channel's user id (just once), so once an iincoming channel is persisted to some local database, it's easier to keep track of.
lightning/src/ln/channelmanager.rs
Outdated
| /// [`Event::FundingGenerationReady`]: events::Event::FundingGenerationReady | ||
| /// [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id | ||
| /// [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id | ||
| pub fn create_channel(&self, their_network_key: PublicKey, channel_value_satoshis: u64, push_msat: u64, user_id: u64, override_config: Option<UserConfig>) -> Result<[u8; 32], APIError> { |
There was a problem hiding this comment.
Would it make sense to create a type alias for the channel id here instead of just [u8; 32]?
There was a problem hiding this comment.
Yea, maybe lets do that as a part of addressing #105? We'll want to separate the types out between temporary channel ids and permanent ones, I think.
Yea, there's a few things we should probably consider for the user id, since its not new or (materially) changed in this PR, lets leave it for a followup and figure out what we want to do with it in #1125. |
valentinewallace
left a comment
There was a problem hiding this comment.
Minor suggestions only
|
Oops, sorry, fixed missing renames for user_id. |
347c49e to
656a4a1
Compare
656a4a1 to
bb7ef6c
Compare
|
Squashed the fixup commit down, diff since Jeff's ACK: |
|
Diff since Val's ACK is also just one trivial variable rename, so gonna take this. Gotta wait on #1127 anyway: |
Its pretty hard for users to track a channel pre-funding to ChannelClosed especially when our counterparty closed the channel due to a parameter mismatch. This resolves that with more data in the relevant events.