Skip to content

Conversation

@Roasbeef
Copy link
Member

@Roasbeef Roasbeef commented Jul 19, 2024

Once we call fundVirtualPacket, we've locked inputs assuming it succeeds. If for w/e reason, the remote peer fails to send us the first ack (before the call to completeChannelFunding), then before this commit, we would fail to unlock the inputs. Only after the call to completeChannelFunding would we unlock the UTXOs.

In this commit, we use two new defers to ensure that we always unlock the UTXOs if the pre-setup fails, and also if completeChannelFunding fails.

Fixes #1019

Once we call `fundVirtualPacket`, we've locked inputs assuming it
succeeds. If for w/e reason, the remote peer fails to send us the first
ack (before the call to `completeChannelFunding`), then before this
commit, we would fail to unlock the inputs. Only after the call to
`completeChannelFunding` would we unlock the UTXOs.

In this commit, we use two new defers to ensure that we always unlock
the UTXOs if the pre-setup fails, and also if `completeChannelFunding`
fails.
return nil, err
}

fundingState.lockedAssetInputs = fn.Map(
Copy link
Member Author

@Roasbeef Roasbeef Jul 19, 2024

Choose a reason for hiding this comment

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

I moved this down (called earlier) so we track the locked inputs as soon as the initial vPSBT funding finishes.

Copy link
Contributor

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Nice, LGTM 🎉

Copy link
Member

@GeorgeTsagk GeorgeTsagk left a comment

Choose a reason for hiding this comment

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

LGTM
nice trick with the setupSuccess/completeSuccess flags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

[bug]: In Ver lightning-terminal:v0.13.99-alpha.rc4

4 participants