Merge pull request #614 from maticnetwork/ancient-datadir

Added ancient datadir flag and toml field
This commit is contained in:
Arpit Temani 2022-12-05 12:24:54 +05:30 committed by GitHub
commit dd64fa160c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 24 additions and 0 deletions

View file

@ -6,6 +6,7 @@ chain = "mainnet"
# identity = "Pratiks-MacBook-Pro.local" # identity = "Pratiks-MacBook-Pro.local"
# log-level = "INFO" # log-level = "INFO"
datadir = "/var/lib/bor/data" datadir = "/var/lib/bor/data"
# ancient = ""
# keystore = "/var/lib/bor/keystore" # keystore = "/var/lib/bor/keystore"
syncmode = "full" syncmode = "full"
# gcmode = "full" # gcmode = "full"

View file

@ -6,6 +6,7 @@ chain = "mainnet" # Name of the chain to sync ("mumbai", "mainnet") o
identity = "Annon-Identity" # Name/Identity of the node (default = OS hostname) identity = "Annon-Identity" # Name/Identity of the node (default = OS hostname)
log-level = "INFO" # Set log level for the server log-level = "INFO" # Set log level for the server
datadir = "var/lib/bor" # Path of the data directory to store information datadir = "var/lib/bor" # Path of the data directory to store information
ancient = "" # Data directory for ancient chain segments (default = inside chaindata)
keystore = "" # Path of the directory where keystores are located keystore = "" # Path of the directory where keystores are located
syncmode = "full" # Blockchain sync mode (only "full" sync supported) syncmode = "full" # Blockchain sync mode (only "full" sync supported)
gcmode = "full" # Blockchain garbage collection mode ("full", "archive") gcmode = "full" # Blockchain garbage collection mode ("full", "archive")

View file

@ -53,6 +53,9 @@ type Config struct {
// DataDir is the directory to store the state in // DataDir is the directory to store the state in
DataDir string `hcl:"datadir,optional" toml:"datadir,optional"` DataDir string `hcl:"datadir,optional" toml:"datadir,optional"`
// Ancient is the directory to store the state in
Ancient string `hcl:"ancient,optional" toml:"ancient,optional"`
// KeyStoreDir is the directory to store keystores // KeyStoreDir is the directory to store keystores
KeyStoreDir string `hcl:"keystore,optional" toml:"keystore,optional"` KeyStoreDir string `hcl:"keystore,optional" toml:"keystore,optional"`
@ -398,6 +401,7 @@ func DefaultConfig() *Config {
RequiredBlocks: map[string]string{}, RequiredBlocks: map[string]string{},
LogLevel: "INFO", LogLevel: "INFO",
DataDir: DefaultDataDir(), DataDir: DefaultDataDir(),
Ancient: "",
P2P: &P2PConfig{ P2P: &P2PConfig{
MaxPeers: 50, MaxPeers: 50,
MaxPendPeers: 50, MaxPendPeers: 50,
@ -879,6 +883,10 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*
n.BorLogs = c.BorLogs n.BorLogs = c.BorLogs
n.DatabaseHandles = dbHandles n.DatabaseHandles = dbHandles
if c.Ancient != "" {
n.DatabaseFreezer = c.Ancient
}
return &n, nil return &n, nil
} }

View file

@ -33,6 +33,12 @@ func (c *Command) Flags() *flagset.Flagset {
Value: &c.cliConfig.DataDir, Value: &c.cliConfig.DataDir,
Default: c.cliConfig.DataDir, Default: c.cliConfig.DataDir,
}) })
f.StringFlag(&flagset.StringFlag{
Name: "datadir.ancient",
Usage: "Data directory for ancient chain segments (default = inside chaindata)",
Value: &c.cliConfig.Ancient,
Default: c.cliConfig.Ancient,
})
f.StringFlag(&flagset.StringFlag{ f.StringFlag(&flagset.StringFlag{
Name: "keystore", Name: "keystore",
Usage: "Path of the directory where keystores are located", Usage: "Path of the directory where keystores are located",

View file

@ -2,6 +2,7 @@ chain = "mainnet"
# identity = "node_name" # identity = "node_name"
# log-level = "INFO" # log-level = "INFO"
datadir = "/var/lib/bor/data" datadir = "/var/lib/bor/data"
# ancient = ""
# keystore = "" # keystore = ""
syncmode = "full" syncmode = "full"
gcmode = "archive" gcmode = "archive"

View file

@ -2,6 +2,7 @@ chain = "mainnet"
# identity = "node_name" # identity = "node_name"
# log-level = "INFO" # log-level = "INFO"
datadir = "/var/lib/bor/data" datadir = "/var/lib/bor/data"
# ancient = ""
# keystore = "" # keystore = ""
syncmode = "full" syncmode = "full"
# gcmode = "full" # gcmode = "full"

View file

@ -4,6 +4,7 @@ chain = "mainnet"
# identity = "node_name" # identity = "node_name"
# log-level = "INFO" # log-level = "INFO"
datadir = "/var/lib/bor/data" datadir = "/var/lib/bor/data"
# ancient = ""
# keystore = "$BOR_DIR/keystore" # keystore = "$BOR_DIR/keystore"
syncmode = "full" syncmode = "full"
# gcmode = "full" # gcmode = "full"

View file

@ -4,6 +4,7 @@ chain = "mainnet"
# identity = "node_name" # identity = "node_name"
# log-level = "INFO" # log-level = "INFO"
datadir = "/var/lib/bor/data" datadir = "/var/lib/bor/data"
# ancient = ""
# keystore = "$BOR_DIR/keystore" # keystore = "$BOR_DIR/keystore"
syncmode = "full" syncmode = "full"
# gcmode = "full" # gcmode = "full"

View file

@ -2,6 +2,7 @@ chain = "mumbai"
# identity = "node_name" # identity = "node_name"
# log-level = "INFO" # log-level = "INFO"
datadir = "/var/lib/bor/data" datadir = "/var/lib/bor/data"
# ancient = ""
# keystore = "" # keystore = ""
syncmode = "full" syncmode = "full"
gcmode = "archive" gcmode = "archive"

View file

@ -2,6 +2,7 @@ chain = "mumbai"
# identity = "node_name" # identity = "node_name"
# log-level = "INFO" # log-level = "INFO"
datadir = "/var/lib/bor/data" datadir = "/var/lib/bor/data"
# ancient = ""
# keystore = "" # keystore = ""
syncmode = "full" syncmode = "full"
# gcmode = "full" # gcmode = "full"

View file

@ -4,6 +4,7 @@ chain = "mumbai"
# identity = "node_name" # identity = "node_name"
# log-level = "INFO" # log-level = "INFO"
datadir = "/var/lib/bor/data" datadir = "/var/lib/bor/data"
# ancient = ""
# keystore = "$BOR_DIR/keystore" # keystore = "$BOR_DIR/keystore"
syncmode = "full" syncmode = "full"
# gcmode = "full" # gcmode = "full"

View file

@ -4,6 +4,7 @@ chain = "mumbai"
# identity = "node_name" # identity = "node_name"
# log-level = "INFO" # log-level = "INFO"
datadir = "/var/lib/bor/data" datadir = "/var/lib/bor/data"
# ancient = ""
# keystore = "$BOR_DIR/keystore" # keystore = "$BOR_DIR/keystore"
syncmode = "full" syncmode = "full"
# gcmode = "full" # gcmode = "full"