Skip to content

Commit 2713837

Browse files
authored
Merge pull request #193 from lightninglabs/sweepremoteclosed-cln
CLN: Make sweepremoteclosed and triggerforceclose CLN compatible
2 parents b141033 + 75030dc commit 2713837

File tree

9 files changed

+513
-108
lines changed

9 files changed

+513
-108
lines changed

README.md

Lines changed: 44 additions & 40 deletions
Large diffs are not rendered by default.

cln/signer.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,17 @@ import (
1515
)
1616

1717
type 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

2131
func (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+
3457
func (s *Signer) FetchPrivateKey(
3558
descriptor *keychain.KeyDescriptor) (*btcec.PrivateKey, error) {
3659

0 commit comments

Comments
 (0)