@@ -15,7 +15,17 @@ import (
1515)
1616
1717type Signer struct {
18+ * input.MusigSessionManager
19+
1820 HsmSecret [32 ]byte
21+
22+ // SwapDescKeyAfterDerive is a boolean that indicates that after
23+ // deriving the private key from the key descriptor (which interprets
24+ // the public key as the peer's public key), we should swap the public
25+ // key in the key descriptor to the actual derived public key. This is
26+ // required for P2WKH signatures that need to have the public key in the
27+ // witness stack.
28+ SwapDescKeyAfterDerive bool
1929}
2030
2131func (s * Signer ) SignOutputRaw (tx * wire.MsgTx ,
@@ -28,9 +38,22 @@ func (s *Signer) SignOutputRaw(tx *wire.MsgTx,
2838 return nil , err
2939 }
3040
41+ if s .SwapDescKeyAfterDerive {
42+ // If we need to swap the public key in the descriptor, we do so
43+ // now. This is required for P2WKH signatures that need to have
44+ // the public key in the witness stack.
45+ signDesc .KeyDesc .PubKey = privKey .PubKey ()
46+ }
47+
3148 return lnd .SignOutputRawWithPrivateKey (tx , signDesc , privKey )
3249}
3350
51+ func (s * Signer ) ComputeInputScript (_ * wire.MsgTx , _ * input.SignDescriptor ) (
52+ * input.Script , error ) {
53+
54+ return nil , errors .New ("unimplemented" )
55+ }
56+
3457func (s * Signer ) FetchPrivateKey (
3558 descriptor * keychain.KeyDescriptor ) (* btcec.PrivateKey , error ) {
3659
0 commit comments