@@ -1564,6 +1564,7 @@ func encodeTaprootAuxData(w io.Writer, c *ContractResolutions) error {
15641564		})
15651565	}
15661566
1567+ 	htlcBlobs  :=  newAuxHtlcBlobs ()
15671568	for  _ , htlc  :=  range  c .HtlcResolutions .IncomingHTLCs  {
15681569		htlc  :=  htlc 
15691570
@@ -1574,8 +1575,9 @@ func encodeTaprootAuxData(w io.Writer, c *ContractResolutions) error {
15741575			continue 
15751576		}
15761577
1578+ 		var  resID  resolverID 
15771579		if  htlc .SignedSuccessTx  !=  nil  {
1578- 			resID  : =newResolverID (
1580+ 			resID  =  newResolverID (
15791581				htlc .SignedSuccessTx .TxIn [0 ].PreviousOutPoint ,
15801582			)
15811583			//nolint:lll 
@@ -1591,10 +1593,14 @@ func encodeTaprootAuxData(w io.Writer, c *ContractResolutions) error {
15911593				tapCase .CtrlBlocks .Val .IncomingHtlcCtrlBlocks [resID ] =  bridgeCtrlBlock 
15921594			}
15931595		} else  {
1594- 			resID  : =newResolverID (htlc .ClaimOutpoint )
1596+ 			resID  =  newResolverID (htlc .ClaimOutpoint )
15951597			//nolint:lll 
15961598			tapCase .CtrlBlocks .Val .IncomingHtlcCtrlBlocks [resID ] =  ctrlBlock 
15971599		}
1600+ 
1601+ 		htlc .ResolutionBlob .WhenSome (func (b  []byte ) {
1602+ 			htlcBlobs [resID ] =  b 
1603+ 		})
15981604	}
15991605	for  _ , htlc  :=  range  c .HtlcResolutions .OutgoingHTLCs  {
16001606		htlc  :=  htlc 
@@ -1606,8 +1612,9 @@ func encodeTaprootAuxData(w io.Writer, c *ContractResolutions) error {
16061612			continue 
16071613		}
16081614
1615+ 		var  resID  resolverID 
16091616		if  htlc .SignedTimeoutTx  !=  nil  {
1610- 			resID  : =newResolverID (
1617+ 			resID  =  newResolverID (
16111618				htlc .SignedTimeoutTx .TxIn [0 ].PreviousOutPoint ,
16121619			)
16131620			//nolint:lll 
@@ -1625,17 +1632,27 @@ func encodeTaprootAuxData(w io.Writer, c *ContractResolutions) error {
16251632				tapCase .CtrlBlocks .Val .OutgoingHtlcCtrlBlocks [resID ] =  bridgeCtrlBlock 
16261633			}
16271634		} else  {
1628- 			resID  : =newResolverID (htlc .ClaimOutpoint )
1635+ 			resID  =  newResolverID (htlc .ClaimOutpoint )
16291636			//nolint:lll 
16301637			tapCase .CtrlBlocks .Val .OutgoingHtlcCtrlBlocks [resID ] =  ctrlBlock 
16311638		}
1639+ 
1640+ 		htlc .ResolutionBlob .WhenSome (func (b  []byte ) {
1641+ 			htlcBlobs [resID ] =  b 
1642+ 		})
16321643	}
16331644
16341645	if  c .AnchorResolution  !=  nil  {
16351646		anchorSignDesc  :=  c .AnchorResolution .AnchorSignDescriptor 
16361647		tapCase .TapTweaks .Val .AnchorTweak  =  anchorSignDesc .TapTweak 
16371648	}
16381649
1650+ 	if  len (htlcBlobs ) !=  0  {
1651+ 		tapCase .HtlcBlobs  =  tlv .SomeRecordT (
1652+ 			tlv.NewRecordT [tlv.TlvType4 ](htlcBlobs ),
1653+ 		)
1654+ 	}
1655+ 
16391656	return  tapCase .Encode (w )
16401657}
16411658
@@ -1654,6 +1671,8 @@ func decodeTapRootAuxData(r io.Reader, c *ContractResolutions) error {
16541671		})
16551672	}
16561673
1674+ 	htlcBlobs  :=  tapCase .HtlcBlobs .ValOpt ().UnwrapOr (newAuxHtlcBlobs ())
1675+ 
16571676	for  i  :=  range  c .HtlcResolutions .IncomingHTLCs  {
16581677		htlc  :=  c .HtlcResolutions .IncomingHTLCs [i ]
16591678
@@ -1680,7 +1699,12 @@ func decodeTapRootAuxData(r io.Reader, c *ContractResolutions) error {
16801699			htlc .SweepSignDesc .ControlBlock  =  ctrlBlock 
16811700		}
16821701
1702+ 		if  htlcBlob , ok  :=  htlcBlobs [resID ]; ok  {
1703+ 			htlc .ResolutionBlob  =  fn .Some (htlcBlob )
1704+ 		}
1705+ 
16831706		c .HtlcResolutions .IncomingHTLCs [i ] =  htlc 
1707+ 
16841708	}
16851709	for  i  :=  range  c .HtlcResolutions .OutgoingHTLCs  {
16861710		htlc  :=  c .HtlcResolutions .OutgoingHTLCs [i ]
@@ -1708,6 +1732,10 @@ func decodeTapRootAuxData(r io.Reader, c *ContractResolutions) error {
17081732			htlc .SweepSignDesc .ControlBlock  =  ctrlBlock 
17091733		}
17101734
1735+ 		if  htlcBlob , ok  :=  htlcBlobs [resID ]; ok  {
1736+ 			htlc .ResolutionBlob  =  fn .Some (htlcBlob )
1737+ 		}
1738+ 
17111739		c .HtlcResolutions .OutgoingHTLCs [i ] =  htlc 
17121740	}
17131741
0 commit comments