multi: refresh htlcswitch aliases on aliasmgr update

This commit is contained in:
George Tsagkarelis
2024-03-12 18:15:14 +01:00
committed by Oliver Gugger
parent e31cdc4db3
commit ea92d0aecc
8 changed files with 152 additions and 20 deletions

View File

@@ -36,7 +36,8 @@ type aliasHandler interface {
GetPeerAlias(lnwire.ChannelID) (lnwire.ShortChannelID, error)
// AddLocalAlias persists an alias to an underlying alias store.
AddLocalAlias(lnwire.ShortChannelID, lnwire.ShortChannelID, bool) error
AddLocalAlias(lnwire.ShortChannelID, lnwire.ShortChannelID, bool,
bool) error
// GetAliases returns the set of aliases given the main SCID of a
// channel. This SCID will be an alias for zero-conf channels and will

View File

@@ -1263,7 +1263,7 @@ func (f *Manager) advancePendingChannelState(
// Persist the alias to the alias database.
baseScid := channel.ShortChannelID
err := f.cfg.AliasManager.AddLocalAlias(
baseScid, baseScid, true,
baseScid, baseScid, true, false,
)
if err != nil {
return fmt.Errorf("error adding local alias to "+
@@ -3149,7 +3149,7 @@ func (f *Manager) handleFundingConfirmation(
}
err = f.cfg.AliasManager.AddLocalAlias(
aliasScid, confChannel.shortChanID, true,
aliasScid, confChannel.shortChanID, true, false,
)
if err != nil {
return fmt.Errorf("unable to request alias: %w", err)
@@ -3315,7 +3315,7 @@ func (f *Manager) sendChannelReady(completeChan *channeldb.OpenChannel,
err = f.cfg.AliasManager.AddLocalAlias(
alias, completeChan.ShortChannelID,
false,
false, false,
)
if err != nil {
return err
@@ -3892,7 +3892,7 @@ func (f *Manager) handleChannelReady(peer lnpeer.Peer, //nolint:funlen
}
err = f.cfg.AliasManager.AddLocalAlias(
alias, channel.ShortChannelID, false,
alias, channel.ShortChannelID, false, false,
)
if err != nil {
log.Errorf("unable to add local alias: %v",

View File

@@ -162,7 +162,7 @@ func (m *mockAliasMgr) GetPeerAlias(lnwire.ChannelID) (lnwire.ShortChannelID,
}
func (m *mockAliasMgr) AddLocalAlias(lnwire.ShortChannelID,
lnwire.ShortChannelID, bool) error {
lnwire.ShortChannelID, bool, bool) error {
return nil
}