Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cmd/vspadmin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package main

import (
"errors"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -54,11 +55,16 @@ func createDatabase(homeDir string, feeXPub string, network *config.Network) err
}

// Ensure provided xpub is a valid key for the selected network.
_, err := hdkeychain.NewKeyFromString(feeXPub, network.Params)
feeXpub, err := hdkeychain.NewKeyFromString(feeXPub, network.Params)
if err != nil {
return fmt.Errorf("failed to parse feexpub: %w", err)
}

// Ensure key is public.
if feeXpub.IsPrivate() {
return errors.New("feexpub is a private key, should be public")
}

// Ensure the data directory exists.
err = os.MkdirAll(dataDir, 0700)
if err != nil {
Expand Down