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
|
||||
|
||||
- ```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")
|
||||
|
||||
- ```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)
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ The ```bor server``` command runs the Bor client.
|
|||
|
||||
- ```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
|
||||
|
||||
|
|
@ -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.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 string `hcl:"name,optional"`
|
||||
|
||||
// Whitelist is a list of required (block number, hash) pairs to accept
|
||||
Whitelist map[string]string `hcl:"whitelist,optional"`
|
||||
// RequiredBlocks is a list of required (block number, hash) pairs to accept
|
||||
RequiredBlocks map[string]string `hcl:"requiredblocks,optional"`
|
||||
|
||||
// LogLevel is the level of the logs to put out
|
||||
LogLevel string `hcl:"log-level,optional"`
|
||||
|
|
@ -383,11 +383,11 @@ type DeveloperConfig struct {
|
|||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Chain: "mainnet",
|
||||
Name: Hostname(),
|
||||
Whitelist: map[string]string{},
|
||||
LogLevel: "INFO",
|
||||
DataDir: defaultDataDir(),
|
||||
Chain: "mainnet",
|
||||
Name: Hostname(),
|
||||
RequiredBlocks: map[string]string{},
|
||||
LogLevel: "INFO",
|
||||
DataDir: defaultDataDir(),
|
||||
P2P: &P2PConfig{
|
||||
MaxPeers: 30,
|
||||
MaxPendPeers: 50,
|
||||
|
|
@ -745,17 +745,17 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*
|
|||
n.SnapDiscoveryURLs = c.P2P.Discovery.DNS
|
||||
}
|
||||
|
||||
// whitelist
|
||||
// RequiredBlocks
|
||||
{
|
||||
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)
|
||||
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
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ func TestConfigMerge(t *testing.T) {
|
|||
c0 := &Config{
|
||||
Chain: "0",
|
||||
NoSnapshot: true,
|
||||
Whitelist: map[string]string{
|
||||
RequiredBlocks: map[string]string{
|
||||
"a": "b",
|
||||
},
|
||||
TxPool: &TxPoolConfig{
|
||||
|
|
@ -40,7 +40,7 @@ func TestConfigMerge(t *testing.T) {
|
|||
}
|
||||
c1 := &Config{
|
||||
Chain: "1",
|
||||
Whitelist: map[string]string{
|
||||
RequiredBlocks: map[string]string{
|
||||
"b": "c",
|
||||
},
|
||||
P2P: &P2PConfig{
|
||||
|
|
@ -55,7 +55,7 @@ func TestConfigMerge(t *testing.T) {
|
|||
expected := &Config{
|
||||
Chain: "1",
|
||||
NoSnapshot: true,
|
||||
Whitelist: map[string]string{
|
||||
RequiredBlocks: map[string]string{
|
||||
"a": "b",
|
||||
"b": "c",
|
||||
},
|
||||
|
|
@ -104,7 +104,7 @@ func TestConfigLoadFile(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.Equal(t, config, &Config{
|
||||
DataDir: "./data",
|
||||
Whitelist: map[string]string{
|
||||
RequiredBlocks: map[string]string{
|
||||
"a": "b",
|
||||
},
|
||||
P2P: &P2PConfig{
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ func (c *Command) Flags() *flagset.Flagset {
|
|||
Value: &c.cliConfig.GcMode,
|
||||
})
|
||||
f.MapStringFlag(&flagset.MapStringFlag{
|
||||
Name: "whitelist",
|
||||
Name: "requiredblocks",
|
||||
Usage: "Comma separated block number-to-hash mappings to enforce (<number>=<hash>)",
|
||||
Value: &c.cliConfig.Whitelist,
|
||||
Value: &c.cliConfig.RequiredBlocks,
|
||||
})
|
||||
f.BoolFlag(&flagset.BoolFlag{
|
||||
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"
|
||||
|
||||
whitelist = {
|
||||
requiredblocks = {
|
||||
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",
|
||||
"whitelist": {
|
||||
"requiredblocks": {
|
||||
"a": "b"
|
||||
},
|
||||
"p2p": {
|
||||
|
|
|
|||
Loading…
Reference in a new issue