lnwallet+channeldb: add new AuxLeafStore for dynamic aux leaves

In this commit, we add a new AuxLeafStore which can be used to dynamically fetch the latest aux leaves for a given state. This is useful for custom channel types that will store some extra information in the form of a custom blob, then will use that information to derive the new leaf tapscript leaves that may be attached to reach state.
This commit is contained in:
Olaoluwa Osuntokun
2024-03-17 16:53:38 -04:00
committed by Oliver Gugger
parent c36cd9298f
commit d95c1f93f3
6 changed files with 430 additions and 45 deletions

View File

@@ -431,7 +431,7 @@ func (c *chainWatcher) handleUnknownLocalState(
}
remoteScript, _, err := lnwallet.CommitScriptToRemote(
c.cfg.chanState.ChanType, c.cfg.chanState.IsInitiator,
commitKeyRing.ToRemoteKey, leaseExpiry,
commitKeyRing.ToRemoteKey, leaseExpiry, input.NoneTapLeaf(),
)
if err != nil {
return false, err
@@ -444,6 +444,7 @@ func (c *chainWatcher) handleUnknownLocalState(
c.cfg.chanState.ChanType, c.cfg.chanState.IsInitiator,
commitKeyRing.ToLocalKey, commitKeyRing.RevocationKey,
uint32(c.cfg.chanState.LocalChanCfg.CsvDelay), leaseExpiry,
input.NoneTapLeaf(),
)
if err != nil {
return false, err