[lbry] claimtrie: minor refactoring of claimtrie CLI
This commit is contained in:
parent
27c81de4e5
commit
3c85e6e56a
4 changed files with 13 additions and 19 deletions
|
@ -6,22 +6,15 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/btcsuite/btcd/claimtrie/block/blockrepo"
|
"github.com/btcsuite/btcd/claimtrie/block/blockrepo"
|
||||||
"github.com/btcsuite/btcd/claimtrie/config"
|
|
||||||
"github.com/btcsuite/btcd/claimtrie/merkletrie"
|
"github.com/btcsuite/btcd/claimtrie/merkletrie"
|
||||||
"github.com/btcsuite/btcd/claimtrie/merkletrie/merkletrierepo"
|
"github.com/btcsuite/btcd/claimtrie/merkletrie/merkletrierepo"
|
||||||
"github.com/btcsuite/btcd/claimtrie/param"
|
"github.com/btcsuite/btcd/claimtrie/param"
|
||||||
"github.com/btcsuite/btcd/claimtrie/temporal/temporalrepo"
|
"github.com/btcsuite/btcd/claimtrie/temporal/temporalrepo"
|
||||||
"github.com/btcsuite/btcd/wire"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
var localConfig *config.DBConfig
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
param.SetNetwork(wire.MainNet, "mainnet")
|
|
||||||
localConfig = config.GenerateConfig(param.ClaimtrieDataFolder)
|
|
||||||
|
|
||||||
rootCmd.AddCommand(blockCmd)
|
rootCmd.AddCommand(blockCmd)
|
||||||
|
|
||||||
blockCmd.AddCommand(blockLastCmd)
|
blockCmd.AddCommand(blockLastCmd)
|
||||||
|
@ -106,9 +99,9 @@ var blockListCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
var blockNameCmd = &cobra.Command{
|
var blockNameCmd = &cobra.Command{
|
||||||
Use: "vertex <height> [<name>]",
|
Use: "vertex <height> <name>",
|
||||||
Short: "List the claim and child hashes at vertex name of block at height",
|
Short: "List the claim and child hashes at vertex name of block at height",
|
||||||
Args: cobra.RangeArgs(1, 2),
|
Args: cobra.RangeArgs(2, 2),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
|
||||||
repo, err := blockrepo.NewPebble(localConfig.BlockRepoPebble.Path)
|
repo, err := blockrepo.NewPebble(localConfig.BlockRepoPebble.Path)
|
||||||
|
|
|
@ -5,18 +5,13 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/btcsuite/btcd/claimtrie/config"
|
|
||||||
"github.com/btcsuite/btcd/claimtrie/node"
|
"github.com/btcsuite/btcd/claimtrie/node"
|
||||||
"github.com/btcsuite/btcd/claimtrie/node/noderepo"
|
"github.com/btcsuite/btcd/claimtrie/node/noderepo"
|
||||||
"github.com/btcsuite/btcd/claimtrie/param"
|
|
||||||
"github.com/btcsuite/btcd/wire"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
param.SetNetwork(wire.MainNet, "mainnet")
|
|
||||||
localConfig = config.GenerateConfig(param.ClaimtrieDataFolder)
|
|
||||||
rootCmd.AddCommand(nodeCmd)
|
rootCmd.AddCommand(nodeCmd)
|
||||||
|
|
||||||
nodeCmd.AddCommand(nodeDumpCmd)
|
nodeCmd.AddCommand(nodeDumpCmd)
|
||||||
|
|
|
@ -1,9 +1,20 @@
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/btcsuite/btcd/claimtrie/config"
|
||||||
|
"github.com/btcsuite/btcd/claimtrie/param"
|
||||||
|
"github.com/btcsuite/btcd/wire"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var localConfig *config.DBConfig
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
param.SetNetwork(wire.MainNet, "mainnet")
|
||||||
|
localConfig = config.GenerateConfig(param.ClaimtrieDataFolder)
|
||||||
|
}
|
||||||
|
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "claimtrie",
|
Use: "claimtrie",
|
||||||
Short: "ClaimTrie Command Line Interface",
|
Short: "ClaimTrie Command Line Interface",
|
||||||
|
|
|
@ -5,17 +5,12 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/btcsuite/btcd/claimtrie/config"
|
|
||||||
"github.com/btcsuite/btcd/claimtrie/param"
|
|
||||||
"github.com/btcsuite/btcd/claimtrie/temporal/temporalrepo"
|
"github.com/btcsuite/btcd/claimtrie/temporal/temporalrepo"
|
||||||
"github.com/btcsuite/btcd/wire"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
param.SetNetwork(wire.MainNet, "mainnet")
|
|
||||||
localConfig = config.GenerateConfig(param.ClaimtrieDataFolder)
|
|
||||||
rootCmd.AddCommand(temporalCmd)
|
rootCmd.AddCommand(temporalCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue