Skip to content

Commit

Permalink
Display cross mark for 1 sat outputs and don't count to total
Browse files Browse the repository at this point in the history
  • Loading branch information
boecklim committed Aug 23, 2024
1 parent 6ec2ad1 commit d14c77b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cmd/broadcaster-cli/app/keyset/utxos/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strconv"
"time"

"github.com/enescakir/emoji"
"github.com/jedib0t/go-pretty/v6/table"

"github.com/bitcoin-sv/arc/cmd/broadcaster-cli/helper"
Expand Down Expand Up @@ -63,12 +64,22 @@ func getUtxosTable(ctx context.Context, logger *slog.Logger, t table.Writer, key

totalOutputs := 0
for _, satoshi := range satoshiSlice {
satString := strconv.FormatUint(satoshi, 10)

if satoshi == 1 {
satString = satString + " " + emoji.CrossMark.String()
}

columns[counter] = append(columns[counter], row{
satoshis: strconv.FormatUint(satoshi, 10),
satoshis: satString,
outputs: strconv.Itoa(outputsMap[satoshi]),
})

// Do not count 1-sat outputs, as they can't be used as utxos for transactions
if satoshi == 1 {
continue
}

totalOutputs += outputsMap[satoshi]
}

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ require (
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/enescakir/emoji v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-faster/city v1.0.1 // indirect
github.com/go-faster/errors v0.6.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/emicklei/go-restful/v3 v3.12.1 h1:PJMDIM/ak7btuL8Ex0iYET9hxM3CI2sjZtzpL63nKAU=
github.com/emicklei/go-restful/v3 v3.12.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/enescakir/emoji v1.0.0 h1:W+HsNql8swfCQFtioDGDHCHri8nudlK1n5p2rHCJoog=
github.com/enescakir/emoji v1.0.0/go.mod h1:Bt1EKuLnKDTYpLALApstIkAjdDrS/8IAgTkKp+WKFD0=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
Expand Down

0 comments on commit d14c77b

Please sign in to comment.