mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
Merge pull request #405 from cffls/whitelist
Rename whitelist to requiredblocks
This commit is contained in:
commit
63bedf374d
7 changed files with 23 additions and 23 deletions
|
|
@ -14,4 +14,4 @@
|
||||||
|
|
||||||
- ```save-key```: path to save the ecdsa private key
|
- ```save-key```: path to save the ecdsa private key
|
||||||
|
|
||||||
- ```dry-run```
|
- ```dry-run```: validates parameters and prints bootnode configurations, but does not start bootnode
|
||||||
|
|
@ -18,7 +18,7 @@ The ```bor server``` command runs the Bor client.
|
||||||
|
|
||||||
- ```gcmode```: Blockchain garbage collection mode ("full", "archive")
|
- ```gcmode```: Blockchain garbage collection mode ("full", "archive")
|
||||||
|
|
||||||
- ```whitelist```: Comma separated block number-to-hash mappings to enforce (<number>=<hash>)
|
- ```requiredblocks```: Comma separated block number-to-hash mappings to enforce (<number>=<hash>)
|
||||||
|
|
||||||
- ```no-snapshot```: Disables the snapshot-database mode (default = false)
|
- ```no-snapshot```: Disables the snapshot-database mode (default = false)
|
||||||
|
|
||||||
|
|
@ -74,7 +74,7 @@ The ```bor server``` command runs the Bor client.
|
||||||
|
|
||||||
- ```cache.preimages```: Enable recording the SHA3/keccak preimages of trie keys
|
- ```cache.preimages```: Enable recording the SHA3/keccak preimages of trie keys
|
||||||
|
|
||||||
- ```txlookuplimit```: Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain)
|
- ```txlookuplimit```: Number of recent blocks to maintain transactions index for (default = about 56 days, 0 = entire chain)
|
||||||
|
|
||||||
### JsonRPC Options
|
### JsonRPC Options
|
||||||
|
|
||||||
|
|
@ -194,4 +194,4 @@ The ```bor server``` command runs the Bor client.
|
||||||
|
|
||||||
- ```txpool.globalqueue```: Maximum number of non-executable transaction slots for all accounts
|
- ```txpool.globalqueue```: Maximum number of non-executable transaction slots for all accounts
|
||||||
|
|
||||||
- ```txpool.lifetime```: Maximum amount of time non-executable transaction are queued
|
- ```txpool.lifetime```: Maximum amount of time non-executable transaction are queued
|
||||||
|
|
@ -43,8 +43,8 @@ type Config struct {
|
||||||
// Name, or identity of the node
|
// Name, or identity of the node
|
||||||
Name string `hcl:"name,optional"`
|
Name string `hcl:"name,optional"`
|
||||||
|
|
||||||
// Whitelist is a list of required (block number, hash) pairs to accept
|
// RequiredBlocks is a list of required (block number, hash) pairs to accept
|
||||||
Whitelist map[string]string `hcl:"whitelist,optional"`
|
RequiredBlocks map[string]string `hcl:"requiredblocks,optional"`
|
||||||
|
|
||||||
// LogLevel is the level of the logs to put out
|
// LogLevel is the level of the logs to put out
|
||||||
LogLevel string `hcl:"log-level,optional"`
|
LogLevel string `hcl:"log-level,optional"`
|
||||||
|
|
@ -383,11 +383,11 @@ type DeveloperConfig struct {
|
||||||
|
|
||||||
func DefaultConfig() *Config {
|
func DefaultConfig() *Config {
|
||||||
return &Config{
|
return &Config{
|
||||||
Chain: "mainnet",
|
Chain: "mainnet",
|
||||||
Name: Hostname(),
|
Name: Hostname(),
|
||||||
Whitelist: map[string]string{},
|
RequiredBlocks: map[string]string{},
|
||||||
LogLevel: "INFO",
|
LogLevel: "INFO",
|
||||||
DataDir: defaultDataDir(),
|
DataDir: defaultDataDir(),
|
||||||
P2P: &P2PConfig{
|
P2P: &P2PConfig{
|
||||||
MaxPeers: 30,
|
MaxPeers: 30,
|
||||||
MaxPendPeers: 50,
|
MaxPendPeers: 50,
|
||||||
|
|
@ -745,17 +745,17 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*
|
||||||
n.SnapDiscoveryURLs = c.P2P.Discovery.DNS
|
n.SnapDiscoveryURLs = c.P2P.Discovery.DNS
|
||||||
}
|
}
|
||||||
|
|
||||||
// whitelist
|
// RequiredBlocks
|
||||||
{
|
{
|
||||||
n.PeerRequiredBlocks = map[uint64]common.Hash{}
|
n.PeerRequiredBlocks = map[uint64]common.Hash{}
|
||||||
for k, v := range c.Whitelist {
|
for k, v := range c.RequiredBlocks {
|
||||||
number, err := strconv.ParseUint(k, 0, 64)
|
number, err := strconv.ParseUint(k, 0, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("invalid whitelist block number %s: %v", k, err)
|
return nil, fmt.Errorf("invalid required block number %s: %v", k, err)
|
||||||
}
|
}
|
||||||
var hash common.Hash
|
var hash common.Hash
|
||||||
if err = hash.UnmarshalText([]byte(v)); err != nil {
|
if err = hash.UnmarshalText([]byte(v)); err != nil {
|
||||||
return nil, fmt.Errorf("invalid whitelist hash %s: %v", v, err)
|
return nil, fmt.Errorf("invalid required block hash %s: %v", v, err)
|
||||||
}
|
}
|
||||||
n.PeerRequiredBlocks[number] = hash
|
n.PeerRequiredBlocks[number] = hash
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ func TestConfigMerge(t *testing.T) {
|
||||||
c0 := &Config{
|
c0 := &Config{
|
||||||
Chain: "0",
|
Chain: "0",
|
||||||
NoSnapshot: true,
|
NoSnapshot: true,
|
||||||
Whitelist: map[string]string{
|
RequiredBlocks: map[string]string{
|
||||||
"a": "b",
|
"a": "b",
|
||||||
},
|
},
|
||||||
TxPool: &TxPoolConfig{
|
TxPool: &TxPoolConfig{
|
||||||
|
|
@ -40,7 +40,7 @@ func TestConfigMerge(t *testing.T) {
|
||||||
}
|
}
|
||||||
c1 := &Config{
|
c1 := &Config{
|
||||||
Chain: "1",
|
Chain: "1",
|
||||||
Whitelist: map[string]string{
|
RequiredBlocks: map[string]string{
|
||||||
"b": "c",
|
"b": "c",
|
||||||
},
|
},
|
||||||
P2P: &P2PConfig{
|
P2P: &P2PConfig{
|
||||||
|
|
@ -55,7 +55,7 @@ func TestConfigMerge(t *testing.T) {
|
||||||
expected := &Config{
|
expected := &Config{
|
||||||
Chain: "1",
|
Chain: "1",
|
||||||
NoSnapshot: true,
|
NoSnapshot: true,
|
||||||
Whitelist: map[string]string{
|
RequiredBlocks: map[string]string{
|
||||||
"a": "b",
|
"a": "b",
|
||||||
"b": "c",
|
"b": "c",
|
||||||
},
|
},
|
||||||
|
|
@ -104,7 +104,7 @@ func TestConfigLoadFile(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, config, &Config{
|
assert.Equal(t, config, &Config{
|
||||||
DataDir: "./data",
|
DataDir: "./data",
|
||||||
Whitelist: map[string]string{
|
RequiredBlocks: map[string]string{
|
||||||
"a": "b",
|
"a": "b",
|
||||||
},
|
},
|
||||||
P2P: &P2PConfig{
|
P2P: &P2PConfig{
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,9 @@ func (c *Command) Flags() *flagset.Flagset {
|
||||||
Value: &c.cliConfig.GcMode,
|
Value: &c.cliConfig.GcMode,
|
||||||
})
|
})
|
||||||
f.MapStringFlag(&flagset.MapStringFlag{
|
f.MapStringFlag(&flagset.MapStringFlag{
|
||||||
Name: "whitelist",
|
Name: "requiredblocks",
|
||||||
Usage: "Comma separated block number-to-hash mappings to enforce (<number>=<hash>)",
|
Usage: "Comma separated block number-to-hash mappings to enforce (<number>=<hash>)",
|
||||||
Value: &c.cliConfig.Whitelist,
|
Value: &c.cliConfig.RequiredBlocks,
|
||||||
})
|
})
|
||||||
f.BoolFlag(&flagset.BoolFlag{
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
Name: "no-snapshot",
|
Name: "no-snapshot",
|
||||||
|
|
|
||||||
2
internal/cli/server/testdata/simple.hcl
vendored
2
internal/cli/server/testdata/simple.hcl
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
data-dir = "./data"
|
data-dir = "./data"
|
||||||
|
|
||||||
whitelist = {
|
requiredblocks = {
|
||||||
a = "b"
|
a = "b"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
2
internal/cli/server/testdata/simple.json
vendored
2
internal/cli/server/testdata/simple.json
vendored
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"data-dir": "./data",
|
"data-dir": "./data",
|
||||||
"whitelist": {
|
"requiredblocks": {
|
||||||
"a": "b"
|
"a": "b"
|
||||||
},
|
},
|
||||||
"p2p": {
|
"p2p": {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue