Merge branch 'edouardparis:master' into master

pull/63/head
Ioan Bizău 2 years ago committed by GitHub
commit d36f8f0084
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,21 @@
name: Go
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...

@ -70,6 +70,7 @@ columns = [
"ALIAS", # alias of the channel node
"GAUGE", # ascii bar with percent local/capacity
"LOCAL", # the local amount of the channel
# "REMOTE", # the remote amount of the channel
"CAP", # the total capacity of the channel
"SENT", # the total amount sent
"RECEIVED", # the total amount received
@ -80,6 +81,7 @@ columns = [
"PRIVATE", # true if channel is private
"ID", # the id of the channel
# "SCID", # short channel id (BxTxO formatted)
# "NUPD", # number of channel updates
]
[views.transactions]

@ -35,6 +35,7 @@ columns = [
"ALIAS", # alias of the channel node
"GAUGE", # ascii bar with percent local/capacity
"LOCAL", # the local amount of the channel
# "REMOTE", # the remote amount of the channel
"CAP", # the total capacity of the channel
"SENT", # the total amount sent
"RECEIVED", # the total amount received
@ -45,6 +46,7 @@ columns = [
"PRIVATE", # true if channel is private
"ID", # the id of the channel
# "SCID", # short channel id (BxTxO formatted)
# "NUPD", # number of channel updates
]
[views.transactions]

@ -33,6 +33,13 @@ func Int64Sort(a, b int64, o Order) bool {
return a > b
}
func Float64Sort(a, b float64, o Order) bool {
if o == Asc {
return a < b
}
return a > b
}
func UInt64Sort(a, b uint64, o Order) bool {
if o == Asc {
return a < b

@ -132,13 +132,13 @@ func printPolicy(v *gocui.View, p *message.Printer, policy *netModels.RoutingPol
fmt.Fprintln(v, red("disabled"))
}
fmt.Fprintf(v, "%s %d\n",
cyan(" Time lock delta:"), policy.TimeLockDelta)
cyan(" Time lock delta:"), policy.TimeLockDelta)
fmt.Fprintf(v, "%s %d\n",
cyan(" Min htlc:"), policy.MinHtlc)
cyan(" Min htlc:"), policy.MinHtlc)
fmt.Fprintf(v, "%s %d\n",
cyan(" Fee base msat:"), policy.FeeBaseMsat)
cyan(" Fee base msat:"), policy.FeeBaseMsat)
fmt.Fprintf(v, "%s %d\n",
cyan("Fee rate milli msat:"), policy.FeeRateMilliMsat)
cyan(" Fee rate milli msat:"), policy.FeeRateMilliMsat)
}
func (c *Channel) display() {
@ -190,6 +190,20 @@ func (c *Channel) display() {
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 ]"))
for _, htlc := range channel.PendingHTLC {
fmt.Fprintf(v, "%s %t\n",
cyan(" Incoming:"), htlc.Incoming)
fmt.Fprintf(v, "%s %d\n",
cyan(" Amount:"), htlc.Amount)
fmt.Fprintf(v, "%s %d\n",
cyan(" Expiration:"), htlc.ExpirationHeight)
fmt.Fprintln(v)
}
}
}
func NewChannel(channels *models.Channels) *Channel {

@ -330,9 +330,9 @@ func NewChannels(cfg *config.View, chans *models.Channels) *Channels {
name: fmt.Sprintf("%-21s", columns[i]),
sort: func(order models.Order) models.ChannelsSort {
return func(c1, c2 *netmodels.Channel) bool {
return models.Int64Sort(
c1.LocalBalance*100/c1.Capacity,
c2.LocalBalance*100/c2.Capacity,
return models.Float64Sort(
float64(c1.LocalBalance)*100/float64(c1.Capacity),
float64(c2.LocalBalance)*100/float64(c2.Capacity),
order)
}
},
@ -367,6 +367,19 @@ func NewChannels(cfg *config.View, chans *models.Channels) *Channels {
return color.Cyan(opts...)(printer.Sprintf("%12d", c.LocalBalance))
},
}
case "REMOTE":
channels.columns[i] = channelsColumn{
width: 12,
name: fmt.Sprintf("%12s", columns[i]),
sort: func(order models.Order) models.ChannelsSort {
return func(c1, c2 *netmodels.Channel) bool {
return models.Int64Sort(c1.RemoteBalance, c2.RemoteBalance, order)
}
},
display: func(c *netmodels.Channel, opts ...color.Option) string {
return color.Cyan(opts...)(printer.Sprintf("%12d", c.RemoteBalance))
},
}
case "CAP":
channels.columns[i] = channelsColumn{
width: 12,
@ -512,6 +525,19 @@ func NewChannels(cfg *config.View, chans *models.Channels) *Channels {
return color.White(opts...)(fmt.Sprintf("%-14s", ToScid(c.ID)))
},
}
case "NUPD":
channels.columns[i] = channelsColumn{
width: 8,
name: fmt.Sprintf("%-8s", columns[i]),
sort: func(order models.Order) models.ChannelsSort {
return func(c1, c2 *netmodels.Channel) bool {
return models.UInt64Sort(c1.UpdatesCount, c2.UpdatesCount, order)
}
},
display: func(c *netmodels.Channel, opts ...color.Option) string {
return color.White(opts...)(printer.Sprintf("%8d", c.UpdatesCount))
},
}
default:
channels.columns[i] = channelsColumn{
width: 21,

Loading…
Cancel
Save