Skip to content

Commit

Permalink
Added a salts/sec print to vanity searching
Browse files Browse the repository at this point in the history
  • Loading branch information
jclapis committed Oct 15, 2021
1 parent b843997 commit 35e398b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ require (
github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/dustin/go-humanize v1.0.0
github.com/ethereum/go-ethereum v1.10.10
github.com/fatih/color v1.12.0
github.com/glendc/go-external-ip v0.0.0-20200601212049-c872357d968e
Expand Down
8 changes: 7 additions & 1 deletion rocketpool-cli/minipool/vanity.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"sync"
"time"

"github.com/dustin/go-humanize"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/rocket-pool/rocketpool-go/utils/eth"
Expand Down Expand Up @@ -163,6 +164,7 @@ func runWorker(report bool, stop *bool, targetPrefix *big.Int, nodeAddress []byt
// Set up the reporting ticker if requested
var ticker *time.Ticker
var tickerChan chan struct{}
lastSalt := big.NewInt(0).Set(salt)
if report {
start := time.Now()
reportInterval := 5 * time.Second
Expand All @@ -172,7 +174,11 @@ func runWorker(report bool, stop *bool, targetPrefix *big.Int, nodeAddress []byt
for {
select {
case <- ticker.C:
fmt.Printf("At salt 0x%x... %s\n", salt, time.Since(start))
delta := big.NewInt(0).Sub(salt, lastSalt)
deltaFloat, suffix := humanize.ComputeSI(float64(delta.Uint64()) / 5.0)
deltaString := humanize.FtoaWithDigits(deltaFloat, 2) + suffix
fmt.Printf("At salt 0x%x... %s (%s salts/sec)\n", salt, time.Since(start), deltaString)
lastSalt.Set(salt)
case <- tickerChan:
ticker.Stop()
return
Expand Down

0 comments on commit 35e398b

Please sign in to comment.