@@ -10,6 +10,7 @@ open ResultUtils
1010open ResultUtils.Portability
1111
1212type CommitmentToLocalParameters = {
13+ RevocationPubKey: RevocationPubKey
1314 ToSelfDelay: BlockHeightOffset16
1415 LocalDelayedPubKey: DelayedPaymentPubKey
1516}
@@ -33,7 +34,7 @@ type CommitmentToLocalParameters = {
3334 SeqParser.parseToCompletion ops <| seqParser {
3435 do ! checkOpCode OpcodeType.OP_ IF
3536 let! opRevocationPubKey = SeqParser.next()
36- let! _revocationPubKey = seqParser {
37+ let! revocationPubKey = seqParser {
3738 match opRevocationPubKey.PushData with
3839 | null -> return ! SeqParser.abort()
3940 | bytes ->
@@ -69,6 +70,7 @@ type CommitmentToLocalParameters = {
6970 do ! checkOpCode OpcodeType.OP_ ENDIF
7071 do ! checkOpCode OpcodeType.OP_ CHECKSIG
7172 return {
73+ RevocationPubKey = revocationPubKey
7274 ToSelfDelay = toSelfDelay
7375 LocalDelayedPubKey = localDelayedPubKey
7476 }
@@ -96,6 +98,12 @@ type internal CommitmentToLocalExtension() =
9698 // could not be generated.
9799 match pubKey with
98100 | null -> null
101+ | _ when pubKey = parameters.RevocationPubKey.RawPubKey() ->
102+ let revocationSig = signer.Sign ( parameters.RevocationPubKey.RawPubKey())
103+ Script [
104+ Op.GetPushOp ( revocationSig.ToBytes())
105+ Op.op_ Implicit OpcodeType.OP_ TRUE
106+ ]
99107 | _ when pubKey = parameters.LocalDelayedPubKey.RawPubKey() ->
100108 let localDelayedSig = signer.Sign ( parameters.LocalDelayedPubKey.RawPubKey())
101109 Script [
@@ -125,6 +133,8 @@ type internal CommitmentToLocalExtension() =
125133 override self.IsCompatibleKey ( pubKey : PubKey , scriptPubKey : Script ): bool =
126134 match CommitmentToLocalParameters.TryExtractParameters scriptPubKey with
127135 | None -> false
128- | Some parameters -> parameters.LocalDelayedPubKey.RawPubKey() = pubKey
136+ | Some parameters ->
137+ parameters.RevocationPubKey.RawPubKey() = pubKey
138+ || parameters.LocalDelayedPubKey.RawPubKey() = pubKey
129139
130140
0 commit comments