Add optional close address#3702
Conversation
|
Needs rebase |
30168ae to
377e730
Compare
There was a problem hiding this comment.
I'd probably call this function sg like: Matches and maybe move it under lnwire.DeliveryAddress (and add a unit test). WDYT?
There was a problem hiding this comment.
+1 for the unit test, see comment below for context on this check :)
There was a problem hiding this comment.
Does this check add anything (if yes: should emptyness checked for address)
There was a problem hiding this comment.
So here we are checking whether the address our peer has provided matches the pre-negotiated upfront address. There are two cases:
- They did not negotiate an upfront address (it's an optional feature), so we do not need to enforce close out to a specific address
- They did negotiate an upfront address, and we need to check that they're sticking to it; if not, we need to disconnect as per the spec's instruction because they may be comporomised
There was a problem hiding this comment.
nit: As a reader it's really confusing to me that sometimes it's Shutdown, sometimes ShutdownScript. I guess this is because I'm not familiar with the code base yet.
There was a problem hiding this comment.
That's an inconsistency on my side, trying to keep var names brief. I'll settle on one or the other,
|
Thanks for the review @bhandras! |
377e730 to
38acea3
Compare
|
Updated to address comments and rebased on #3655. |
There was a problem hiding this comment.
After taking a closer look, it's always inside a Bolt transaction and therefore atomic.
There was a problem hiding this comment.
Duh :) Sorry, didn't pay attention to what txscropt.PayToAddrScript(addr) returns :)
38acea3 to
ee36c82
Compare
|
Rebased, but going to hold off on review for this one until parent PR is in. |
ee36c82 to
c128b6b
Compare
bhandras
left a comment
There was a problem hiding this comment.
Only nits, other than these: LGTM 💯
c128b6b to
7672cc9
Compare
e1b0b81 to
3ff4ba9
Compare
3ff4ba9 to
6b3280c
Compare
This commit is adapted from @Bluetegu's original pull request lightningnetwork#1462.
This commit is adapted from @Bluetegu's original pull request lightningnetwork#1462.
This commit is adapted from @Bluetegu's original pull request lightningnetwork#1462. This commit reads an optional address to pay funds out to from a user iniitiated close channel address. If the channel already has a shutdown script set, the request will fail if an address is provided. Otherwise, the cooperative close will pay out to the address provided.
6b3280c to
94d3eb6
Compare
|
Rebased to clear proto conflicts :) |
This PR adds a
delivery_addressfield to lnrpc and lncli'sCloseChannelrequest which allows users to specify an address to close out to on cooperative closure of a channel. If an upfront shutdown address was set on channel open, requesting to close the channel out to a specific address will fail.This PR replaces #1462.
This PR is rebased on the open upfront shutdown PR #3655, as much of the logic is shared.
Only the last 3 commits in this PR are relevant for review.