@@ -30,10 +30,16 @@ type taprootBriefcase struct {
3030 // revocation paths.
3131 TapTweaks tlv.RecordT [tlv.TlvType1 , tapTweaks ]
3232
33- // CommitBlob is an optional record that contains an opaque blob that
34- // may be used to properly sweep commitment outputs on a force close
35- // transaction.
36- CommitBlob tlv.OptionalRecordT [tlv.TlvType2 , tlv.Blob ]
33+ // SettledCommitBlob is an optional record that contains an opaque blob
34+ // that may be used to properly sweep commitment outputs on a force
35+ // close transaction.
36+ SettledCommitBlob tlv.OptionalRecordT [tlv.TlvType2 , tlv.Blob ]
37+
38+ // BreachCommitBlob is an optional record that contains an opaque blob
39+ // used to sweep a remote party's breached output.
40+ BreachedCommitBlob tlv.OptionalRecordT [tlv.TlvType3 , tlv.Blob ]
41+
42+ // TODO(roasbeef): htlc blobs
3743}
3844
3945// TODO(roasbeef): morph into new tlv record
@@ -53,9 +59,16 @@ func (t *taprootBriefcase) EncodeRecords() []tlv.Record {
5359 t .CtrlBlocks .Record (), t .TapTweaks .Record (),
5460 }
5561
56- t .CommitBlob .WhenSome (func (r tlv.RecordT [tlv.TlvType2 , tlv.Blob ]) {
57- records = append (records , r .Record ())
58- })
62+ t .SettledCommitBlob .WhenSome (
63+ func (r tlv.RecordT [tlv.TlvType2 , tlv.Blob ]) {
64+ records = append (records , r .Record ())
65+ },
66+ )
67+ t .BreachedCommitBlob .WhenSome (
68+ func (r tlv.RecordT [tlv.TlvType3 , tlv.Blob ]) {
69+ records = append (records , r .Record ())
70+ },
71+ )
5972
6073 return records
6174}
@@ -79,8 +92,12 @@ func (t *taprootBriefcase) Encode(w io.Writer) error {
7992
8093// Decode decodes the given reader into the target struct.
8194func (t * taprootBriefcase ) Decode (r io.Reader ) error {
82- commitBlob := t .CommitBlob .Zero ()
83- records := append (t .DecodeRecords (), commitBlob .Record ())
95+ settledCommitBlob := t .SettledCommitBlob .Zero ()
96+ breachedCommitBlob := t .BreachedCommitBlob .Zero ()
97+ records := append (
98+ t .DecodeRecords (), settledCommitBlob .Record (),
99+ breachedCommitBlob .Record (),
100+ )
84101 stream , err := tlv .NewStream (records ... )
85102 if err != nil {
86103 return err
@@ -91,8 +108,11 @@ func (t *taprootBriefcase) Decode(r io.Reader) error {
91108 return err
92109 }
93110
94- if val , ok := typeMap [t .CommitBlob .TlvType ()]; ok && val == nil {
95- t .CommitBlob = tlv .SomeRecordT (commitBlob )
111+ if val , ok := typeMap [t .SettledCommitBlob .TlvType ()]; ok && val == nil {
112+ t .SettledCommitBlob = tlv .SomeRecordT (settledCommitBlob )
113+ }
114+ if v , ok := typeMap [t .BreachedCommitBlob .TlvType ()]; ok && v == nil {
115+ t .BreachedCommitBlob = tlv .SomeRecordT (breachedCommitBlob )
96116 }
97117
98118 return nil
0 commit comments