Skip to content

Commit 35e398b

Browse files
committed
Added a salts/sec print to vanity searching
1 parent b843997 commit 35e398b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ require (
1515
github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf
1616
github.com/docker/go-connections v0.4.0 // indirect
1717
github.com/docker/go-units v0.4.0 // indirect
18+
github.com/dustin/go-humanize v1.0.0
1819
github.com/ethereum/go-ethereum v1.10.10
1920
github.com/fatih/color v1.12.0
2021
github.com/glendc/go-external-ip v0.0.0-20200601212049-c872357d968e

rocketpool-cli/minipool/vanity.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"sync"
1010
"time"
1111

12+
"github.com/dustin/go-humanize"
1213
"github.com/ethereum/go-ethereum/common"
1314
"github.com/ethereum/go-ethereum/crypto"
1415
"github.com/rocket-pool/rocketpool-go/utils/eth"
@@ -163,6 +164,7 @@ func runWorker(report bool, stop *bool, targetPrefix *big.Int, nodeAddress []byt
163164
// Set up the reporting ticker if requested
164165
var ticker *time.Ticker
165166
var tickerChan chan struct{}
167+
lastSalt := big.NewInt(0).Set(salt)
166168
if report {
167169
start := time.Now()
168170
reportInterval := 5 * time.Second
@@ -172,7 +174,11 @@ func runWorker(report bool, stop *bool, targetPrefix *big.Int, nodeAddress []byt
172174
for {
173175
select {
174176
case <- ticker.C:
175-
fmt.Printf("At salt 0x%x... %s\n", salt, time.Since(start))
177+
delta := big.NewInt(0).Sub(salt, lastSalt)
178+
deltaFloat, suffix := humanize.ComputeSI(float64(delta.Uint64()) / 5.0)
179+
deltaString := humanize.FtoaWithDigits(deltaFloat, 2) + suffix
180+
fmt.Printf("At salt 0x%x... %s (%s salts/sec)\n", salt, time.Since(start), deltaString)
181+
lastSalt.Set(salt)
176182
case <- tickerChan:
177183
ticker.Stop()
178184
return

0 commit comments

Comments
 (0)