-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wallet: allow manually setting the wallet birthday #885
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -693,8 +693,14 @@ func (s *loaderServer) CreateWallet(ctx context.Context, req *pb.CreateWalletReq | |
pubPassphrase = []byte(wallet.InsecurePubPassphrase) | ||
} | ||
|
||
// Use the current time for the birthday when the request's is empty. | ||
bday := req.Birthday | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about:
That then shortens the call below. |
||
if bday == 0 { | ||
bday = time.Now().Unix() | ||
} | ||
|
||
wallet, err := s.loader.CreateNewWallet( | ||
pubPassphrase, req.PrivatePassphrase, req.Seed, time.Now(), | ||
pubPassphrase, req.PrivatePassphrase, req.Seed, time.Unix(bday, 0), | ||
) | ||
if err != nil { | ||
return nil, translateError(err) | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,12 @@ | |
; directory for mainnet and testnet wallets, respectively. | ||
; appdata=~/.btcwallet | ||
|
||
; Unix timestamp representing when the wallet was created, and therefore | ||
; the earliest time the wallet could have participated in any transactions. | ||
; This timestamp will be used to estimate a block height that is an appropriate | ||
; starting place to scan for transactions related to this wallet. | ||
; birthday=1231006505 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should mention the default value/default behavior here. |
||
|
||
|
||
; ------------------------------------------------------------------------------ | ||
; RPC client settings | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -188,7 +188,7 @@ func createWallet(cfg *config) error { | |
} | ||
|
||
fmt.Println("Creating the wallet...") | ||
w, err := loader.CreateNewWallet(pubPass, privPass, seed, time.Now()) | ||
w, err := loader.CreateNewWallet(pubPass, privPass, seed, time.Unix(cfg.Birthday, 0)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, I'm not familiar with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When being used as a standalone tool, you can create a wallet from the command line with |
||
if err != nil { | ||
return err | ||
} | ||
|
@@ -221,7 +221,7 @@ func createSimulationWallet(cfg *config) error { | |
defer db.Close() | ||
|
||
// Create the wallet. | ||
err = wallet.Create(db, pubPass, privPass, nil, activeNet.Params, time.Now()) | ||
err = wallet.Create(db, pubPass, privPass, nil, activeNet.Params, time.Unix(cfg.Birthday, 0)) | ||
if err != nil { | ||
return err | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the default be a very early timestamp instead? Otherwise a user might fear their coins are gone if they don't know to set this parameter and are trying to restore from an old seed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used the current time as the default because that was what was previously used whenever a new wallet was created:
--->