Skip to content

Commit

Permalink
use deterministic wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
gz-c committed Mar 23, 2014
1 parent 86bcb61 commit a90649c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/skycoin/skycoin.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func configureDaemon(c *cli.Config) daemon.Config {
dc.Visor.Config.BlockSigsFile = c.BlockSigsFile
dc.Visor.Config.GenesisSignature = coin.MustSigFromHex(c.GenesisSignature)
dc.Visor.Config.GenesisTimestamp = c.GenesisTimestamp
dc.Visor.Config.WalletConstructor = wallet.NewDeterministicWallet
if c.MasterChain {
// The master chain should be reluctant to expire transactions
dc.Visor.Config.UnconfirmedRefreshRate = time.Hour * 4096
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/readable.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (self *ReadableWallet) ToWallet() (Wallet, error) {

// Saves to filename
func (self *ReadableWallet) Save(filename string) error {
logger.Critical("Saving readable wallet to %s with filename %s", filename,
logger.Info("Saving readable wallet to %s with filename %s", filename,
self.Filename)
return util.SaveJSON(filename, self, 0600)
}
Expand Down
7 changes: 4 additions & 3 deletions src/wallet/wallets.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,20 @@ func LoadWallets(dir string) (Wallets, error) {
if !strings.HasSuffix(name, WalletExt) {
continue
}
rw, err := LoadReadableWallet(filepath.Join(dir, name))
fullpath := filepath.Join(dir, name)
rw, err := LoadReadableWallet(fullpath)
if err != nil {
return nil, err
}
w, err := rw.ToWallet()
if err != nil {
return nil, err
}
logger.Info("Loaded wallet from %s", fullpath)
id := w.GetID()
if kw, ok := have[id]; ok {
return nil, fmt.Errorf("Duplicate wallet file detected. "+
"%s and %s are the same wallet.",
kw.GetFilename(), w.GetFilename())
"%s and %s are the same wallet.", kw.GetFilename(), name)
}
have[id] = w
w.SetFilename(name)
Expand Down

0 comments on commit a90649c

Please sign in to comment.