lnwallet: update channel state machine to use new ScriptDescriptor interface

In this commit, we update the channel state machine to use the new
ScriptDescriptor interface. This fixes some subtle issues with the
existing commits, as for p2wsh we always sign the same witness script,
but for p2tr, the witness script differs depending on which branch is
taken.

With the new abstractions, we can treat p2wsh and p2tr as the same
mostly, right up until we need to obtain a control block or a tap tweak.

All tests have been updated accordingly.
This commit is contained in:
Olaoluwa Osuntokun
2023-08-07 21:09:58 -07:00
parent a244a30f32
commit 4b0139c9ba
8 changed files with 639 additions and 396 deletions

View File

@@ -451,10 +451,10 @@ func (c *chainWatcher) handleUnknownLocalState(
pkScript := output.PkScript
switch {
case bytes.Equal(localScript.PkScript, pkScript):
case bytes.Equal(localScript.PkScript(), pkScript):
ourCommit = true
case bytes.Equal(remoteScript.PkScript, pkScript):
case bytes.Equal(remoteScript.PkScript(), pkScript):
ourCommit = true
}
}