chanacceptor: support dual funding internally (funding)
https://github.com/lightningnetwork/lnd/pull/7216
Host: ziggie1984 -
Notes
- This PR Review Club session is Part 1 of a series on Dual-Funding-Channels PRs where we are going to look at the current Channelopening Mechanics getting us acquainted with the current logic and the Specification regarding its implementation (mainly Bolt02). Main Focus will lie on the PRS https://github.com/lightningnetwork/lnd/pull/7145 and https://github.com/lightningnetwork/lnd/pull/7216
- PR 7145 introduces the new OpenChannel2 and AcceptChannel2 messages.
- PR 7216 adds part of the new Dual-Funding options to the channelacceptor-package.
- We will be focusing on the last 2: #7354 & #7357
- Recommendation of Tasks in preparation of the Review meeting apart from Reviewing the PRs in question
- Read the current Bolt02 specification of the Channel Establishment (https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#channel-establishment)
- Read new Specification Bolt02 of the proposed Dual-Funding (Channel Establishment V2)(https://github.com/niftynei/lightning-rfc/blob/nifty/dual-fund/02-peer-protocol.md#sharing-funding-signatures-tx_signatures)
- (Optional if you wanna learn more about the Roadmap) For background knowledge about the issue: https://github.com/lightningnetwork/lnd/issues/6569
- Lnd Codebase mainly package: chanacceptor, lnwire, funding
Questions
General questions:
- What’s the difference between
max_htlc_value_in_flight_msat
andhtlc_maximum_msat
. One found in the open_channel msg and the other found inchannel_update
? - (optional) Can Channel-Constraints be asymmetrical (different for remote and local) according to the specification and lnd ?
- What’s the principle behind the tlv-records in every message-type for example
open_channel
. What’s the difference between theupfront_shutdown_script
feature compared to the other two features of theopen_channel
message and which implications does this have in the code. - (optional) Is it currently possible in lnd to send an OpenChannel msg with an Upfront_Shutdown_Script although the peer does not signal
option_upfront_shutdown_script
? - (optional) What’s the max-limit of the push-amt where is it enforced in the code-base, can we push even beyond channel-reserve ?
- What’s the main difference between Channel-Establishment V1 vs Channel-Establishment V2. Why was it decided to go for a new OpenChannel2 and AcceptChannel2 instead of using the tlv-record of the legacy message types OpenChannel/AcceptChannel
#7145
- What happened to the channel-reserve in the OpenChannel2, what advantages/disadvantages does this approach have?
- How and why did the definition of the channelid change (pending and final channel id), why does there even exist a pending and a final channelid ?
- How do AcceptCannel and AcceptChannel2 differ, they are almost identical aren’t they ?
- (optional) Could the UpfrontShutdownScript in type AcceptChannel2 also be a pointer instead of a value here, compared to for example ChannelType ?
- Describe the concept of FuzzTests, why is the Seed important in this Scenario. Why can we not use the
reflect.DeepEqual
(using the harness) but instead need to compare every part of the message manually. (Seefuzz_test.go
)
#7216: only the commits 6-9 matter the others are the same as in (7145)
- What’s the purpose of the chanacceptor (does it only take effect for all ChannelOpenRequest we receive or also for the ones we initiate ?) - and can more than one channel acceptor be subscribed to the lnd daemon.
- (optional) How does this design differ compared to the htlcacceptor ?
- How does lnd guarantee integrity of data when several clients are registered and receive respond to the same OpenChannel reqeust ?
- Do we check the response of the acceptor-rpcclient for data plausibility ? (study tests)
- Can the funding_amt of the AcceptChannel2 msg be set by an acceptor rpcclient after this PR is lockedin ? Please explain with relevant coding parts