Skip to content

Commit

Permalink
Merge pull request #1023 from SiaFoundation/chris/print-wallet-address
Browse files Browse the repository at this point in the history
Print address when generating new seed to match hostd behaviour
  • Loading branch information
ChrisSchinnerl authored Mar 5, 2024
2 parents b3ca95d + 798dd31 commit 95f052f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 156 deletions.
21 changes: 14 additions & 7 deletions cmd/renterd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"time"

"go.sia.tech/core/types"
"go.sia.tech/coreutils/wallet"
"go.sia.tech/jape"
"go.sia.tech/renterd/api"
"go.sia.tech/renterd/autopilot"
Expand All @@ -25,7 +26,6 @@ import (
"go.sia.tech/renterd/internal/node"
"go.sia.tech/renterd/s3"
"go.sia.tech/renterd/stores"
"go.sia.tech/renterd/wallet"
"go.sia.tech/renterd/worker"
"go.sia.tech/web/renterd"
"go.uber.org/zap"
Expand Down Expand Up @@ -160,11 +160,11 @@ func getSeed() types.PrivateKey {
fmt.Println()
phrase = string(pw)
}
key, err := wallet.KeyFromPhrase(phrase)
if err != nil {
log.Fatal(err)
var rawSeed [32]byte
if err := wallet.SeedFromPhrase(&rawSeed, phrase); err != nil {
panic(err)
}
seed = key
seed = wallet.KeyFromSeed(&rawSeed, 0)
}
return seed
}
Expand Down Expand Up @@ -315,8 +315,15 @@ func main() {
log.Println("Build Date:", build.BuildTime())
return
} else if flag.Arg(0) == "seed" {
log.Println("Seed phrase:")
fmt.Println(wallet.NewSeedPhrase())
var seed [32]byte
phrase := wallet.NewSeedPhrase()
if err := wallet.SeedFromPhrase(&seed, phrase); err != nil {
println(err.Error())
os.Exit(1)
}
key := wallet.KeyFromSeed(&seed, 0)
fmt.Println("Recovery Phrase:", phrase)
fmt.Println("Address", types.StandardUnlockHash(key.PublicKey()))
return
} else if flag.Arg(0) == "config" {
cmdBuildConfig()
Expand Down
Loading

0 comments on commit 95f052f

Please sign in to comment.