multi: thread thru the AuxLeafStore everywhere

This commit is contained in:
Oliver Gugger
2024-04-25 19:00:42 +02:00
parent 180648072c
commit b1c8a836e3
15 changed files with 194 additions and 47 deletions

View File

@@ -193,6 +193,9 @@ type chainWatcherConfig struct {
// obfuscater. This is used by the chain watcher to identify which
// state was broadcast and confirmed on-chain.
extractStateNumHint func(*wire.MsgTx, [lnwallet.StateHintSize]byte) uint64
// auxLeafStore can be used to fetch information for custom channels.
auxLeafStore fn.Option[lnwallet.AuxLeafStore]
}
// chainWatcher is a system that's assigned to every active channel. The duty
@@ -867,7 +870,7 @@ func (c *chainWatcher) handlePossibleBreach(commitSpend *chainntnfs.SpendDetail,
spendHeight := uint32(commitSpend.SpendingHeight)
retribution, err := lnwallet.NewBreachRetribution(
c.cfg.chanState, broadcastStateNum, spendHeight,
commitSpend.SpendingTx,
commitSpend.SpendingTx, c.cfg.auxLeafStore,
)
switch {
@@ -1117,8 +1120,8 @@ func (c *chainWatcher) dispatchLocalForceClose(
"detected", c.cfg.chanState.FundingOutpoint)
forceClose, err := lnwallet.NewLocalForceCloseSummary(
c.cfg.chanState, c.cfg.signer,
commitSpend.SpendingTx, stateNum,
c.cfg.chanState, c.cfg.signer, commitSpend.SpendingTx, stateNum,
c.cfg.auxLeafStore,
)
if err != nil {
return err
@@ -1211,7 +1214,7 @@ func (c *chainWatcher) dispatchRemoteForceClose(
// channel on-chain.
uniClose, err := lnwallet.NewUnilateralCloseSummary(
c.cfg.chanState, c.cfg.signer, commitSpend,
remoteCommit, commitPoint,
remoteCommit, commitPoint, c.cfg.auxLeafStore,
)
if err != nil {
return err