lnwallet: update channel state machine to be aware of tweakless commits
In this commit, we update the channel state machine to be aware of tweakless commits. In several areas, we'll now check the channel's type to see if it's `SingleFunderTweakless`. If so, then we'll opt to use the remote party's non-delay based point directly in the script, skipping any additional cryptographic operations. Along the way we move the `validateCommitmentSanity` method to be defined _before_ it's used as is cutomary within the codebase. Notably, within the `NewUnilateralCloseSummary` method, we'll now _blank out_ the `SingleTweak` value if the commitment is tweakless. This indicates to callers the witness type they should map to, as the value isn't needed at all any longer when sweeping a non-delay output. We also update the signing+verification tests to also test that we're able to properly generate a valid witness for the new tweakless commitment format.
This commit is contained in:
8 files changed
+394
-275
No files matched your search
@@ -869,6 +869,14 @@ func (c *OpenChannel) ChanSyncMsg() (*lnwire.ChannelReestablish, error) {
|
||||
// allowing us to sweep our funds.
|
||||
if c.hasChanStatus(ChanStatusRestored) {
|
||||
currentCommitSecret[0] ^= 1
|
||||
|
||||
// If this is a tweakless channel, then we'll purposefully send
|
||||
// a next local height taht's invalid to trigger a force close
|
||||
// on their end. We do this as tweakless channels don't require
|
||||
// that the commitment point is valid, only that it's present.
|
||||
if c.ChanType.IsTweakless() {
|
||||
nextLocalCommitHeight = 0
|
||||
}
|
||||
}
|
||||
|
||||
return &lnwire.ChannelReestablish{
|
||||
|
||||
Reference in new issue
Block a user