From ad0de06319aedadf33b3e584696d5b87c8838a31 Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Tue, 7 Nov 2023 12:13:19 +0200 Subject: [PATCH] netann: use ChannelUpdate interface in ExtractChannelUpdate --- netann/channel_update.go | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/netann/channel_update.go b/netann/channel_update.go index 08d83dfe2..41ff9f1f3 100644 --- a/netann/channel_update.go +++ b/netann/channel_update.go @@ -125,7 +125,7 @@ func SignChannelUpdate(signer keychain.MessageSignerRing, // NOTE: The passed policies can be nil. func ExtractChannelUpdate(ownerPubKey []byte, info models.ChannelEdgeInfo, policies ...models.ChannelEdgePolicy) ( - *lnwire.ChannelUpdate1, error) { + lnwire.ChannelUpdate, error) { // Helper function to extract the owner of the given policy. owner := func(edge models.ChannelEdgePolicy) []byte { @@ -147,19 +147,7 @@ func ExtractChannelUpdate(ownerPubKey []byte, // Extract the channel update from the policy we own, if any. for _, edge := range policies { if edge != nil && bytes.Equal(ownerPubKey, owner(edge)) { - update, err := ChannelUpdateFromEdge(info, edge) - if err != nil { - return nil, err - } - - chanUpd1, ok := update.(*lnwire.ChannelUpdate1) - if !ok { - return nil, fmt.Errorf("expected "+ - "*lnwire.ChannelUpdate1, got: %T", - chanUpd1) - } - - return chanUpd1, nil + return ChannelUpdateFromEdge(info, edge) } }