@@ -7696,14 +7696,29 @@ func NewLocalForceCloseSummary(chanState *channeldb.OpenChannel,
76967696 & chanState .LocalChanCfg , & chanState .RemoteChanCfg ,
76977697 )
76987698
7699+ localCommit := chanState .LocalCommitment
7700+
7701+ // If we have a custom blob, then we'll attempt to fetch the aux leaves
7702+ // for this state.
7703+ auxLeaves , err := AuxLeavesFromCommit (
7704+ chanState , localCommit , leafStore , * keyRing ,
7705+ )
7706+ if err != nil {
7707+ return nil , fmt .Errorf ("unable to fetch aux leaves: %w" , err )
7708+ }
7709+
76997710 var leaseExpiry uint32
77007711 if chanState .ChanType .HasLeaseExpiration () {
77017712 leaseExpiry = chanState .ThawHeight
77027713 }
7714+
7715+ localAuxLeaf := fn .MapOption (func (l CommitAuxLeaves ) input.AuxTapLeaf {
7716+ return l .LocalAuxLeaf
7717+ })(auxLeaves )
77037718 toLocalScript , err := CommitScriptToSelf (
77047719 chanState .ChanType , chanState .IsInitiator , keyRing .ToLocalKey ,
77057720 keyRing .RevocationKey , csvTimeout , leaseExpiry ,
7706- input . NoneTapLeaf ( ),
7721+ fn . FlattenOption ( localAuxLeaf ),
77077722 )
77087723 if err != nil {
77097724 return nil , err
@@ -7817,15 +7832,6 @@ func NewLocalForceCloseSummary(chanState *channeldb.OpenChannel,
78177832 // outgoing HTLC's that we'll need to claim as well. If this is after
78187833 // recovery there is not much we can do with HTLCs, so we'll always
78197834 // use what we have in our latest state when extracting resolutions.
7820- localCommit := chanState .LocalCommitment
7821-
7822- auxLeaves , err := AuxLeavesFromCommit (
7823- chanState , localCommit , leafStore , * keyRing ,
7824- )
7825- if err != nil {
7826- return nil , fmt .Errorf ("unable to fetch aux leaves: %w" , err )
7827- }
7828-
78297835 htlcResolutions , err := extractHtlcResolutions (
78307836 chainfee .SatPerKWeight (localCommit .FeePerKw ), true , signer ,
78317837 localCommit .Htlcs , keyRing , & chanState .LocalChanCfg ,
0 commit comments