From 6c6372f74071b14196fd51be546416565d34d430 Mon Sep 17 00:00:00 2001 From: rkfg Date: Fri, 2 Sep 2022 18:05:04 +0300 Subject: [PATCH] Remove WeFirst parameter altogether --- network/backend/lnd/lnd.go | 4 ++-- network/models/channel.go | 1 - ui/views/channel.go | 7 ++----- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/network/backend/lnd/lnd.go b/network/backend/lnd/lnd.go index 35ee23e..bf50c67 100644 --- a/network/backend/lnd/lnd.go +++ b/network/backend/lnd/lnd.go @@ -371,8 +371,8 @@ func (l Backend) GetChannelInfo(ctx context.Context, channel *models.Channel) er if err != nil { return errors.WithStack(err) } - if info != nil { - channel.WeFirst = resp.Node1Pub == info.IdentityPubkey + if info != nil && resp.Node1Pub != info.IdentityPubkey { + channel.Policy1, channel.Policy2 = channel.Policy2, channel.Policy1 } return nil diff --git a/network/models/channel.go b/network/models/channel.go index 973eac7..b57cbcf 100644 --- a/network/models/channel.go +++ b/network/models/channel.go @@ -49,7 +49,6 @@ type Channel struct { PendingHTLC []*HTLC LastUpdate *time.Time Node *Node - WeFirst bool Policy1 *RoutingPolicy Policy2 *RoutingPolicy } diff --git a/ui/views/channel.go b/ui/views/channel.go index 95297b0..39568da 100644 --- a/ui/views/channel.go +++ b/ui/views/channel.go @@ -230,17 +230,14 @@ func (c *Channel) display() { } } - if channel.Policy1 != nil && channel.WeFirst { + if channel.Policy1 != nil { printPolicy(v, p, channel.Policy1, true) } if channel.Policy2 != nil { - printPolicy(v, p, channel.Policy2, !channel.WeFirst) + printPolicy(v, p, channel.Policy2, false) } - if channel.Policy1 != nil && !channel.WeFirst { - printPolicy(v, p, channel.Policy1, false) - } if len(channel.PendingHTLC) > 0 { fmt.Fprintln(v) fmt.Fprintln(v, green(" [ Pending HTLCs ]"))