Skip to content

Commit

Permalink
Don't set for any private channels
Browse files Browse the repository at this point in the history
  • Loading branch information
nyonson committed Apr 26, 2023
1 parent 5a3bcc0 commit ee8f01d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions lightning/lightning.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ type Channel struct {
LocalFee FeePPM
RemoteBalance Satoshi
RemoteNode Node
Private bool
}

// Liquidity percent of the channel that is local.
Expand Down
6 changes: 3 additions & 3 deletions lnd/lnd.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,16 @@ func (l Lnd) GetChannel(ctx context.Context, channelID lightning.ChannelID) (lig
if lightning.ChannelID(ci.ChannelID) == channelID {
c.LocalBalance = lightning.Satoshi(ci.LocalBalance.ToUnit(btcutil.AmountSatoshi))
c.RemoteBalance = lightning.Satoshi(ci.RemoteBalance.ToUnit(btcutil.AmountSatoshi))
c.Private = ci.Private
}
}

return c, nil
}

// ListChannels of local node.
//
// Assumes we don't want to act on private channel liquidity management.
func (l Lnd) ListChannels(ctx context.Context) (lightning.Channels, error) {
channelInfos, err := l.c.ListChannels(ctx, false, true)
channelInfos, err := l.c.ListChannels(ctx, false, false)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -230,6 +229,7 @@ func (l Lnd) ListChannels(ctx context.Context) (lightning.Channels, error) {
Updated: remote.LastUpdate,
Addresses: remote.Addresses,
},
Private: ci.Private,
}
}

Expand Down
2 changes: 1 addition & 1 deletion raiju.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func (r Raiju) setFees(ctx context.Context, channels lightning.Channels) (map[li
// update channel fees based on liquidity, but only change if necessary
for _, c := range channels {
fee := r.f.Fee(c)
if c.LocalFee != fee {
if c.LocalFee != fee && !c.Private {
err := r.l.SetFees(ctx, c.ChannelID, fee)
if err != nil {
return map[lightning.ChannelID]lightning.FeePPM{}, err
Expand Down

0 comments on commit ee8f01d

Please sign in to comment.