mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-11 06:23:47 +00:00
merge v0.2.17
This commit is contained in:
commit
4c8ff3a062
6 changed files with 18 additions and 18 deletions
|
|
@ -109,7 +109,7 @@ var (
|
||||||
utils.UltraLightFractionFlag,
|
utils.UltraLightFractionFlag,
|
||||||
utils.UltraLightOnlyAnnounceFlag,
|
utils.UltraLightOnlyAnnounceFlag,
|
||||||
utils.LightNoSyncServeFlag,
|
utils.LightNoSyncServeFlag,
|
||||||
utils.EthPeerRequiredBlocksFlag,
|
utils.EthRequiredBlocksFlag,
|
||||||
utils.LegacyWhitelistFlag,
|
utils.LegacyWhitelistFlag,
|
||||||
utils.BloomFilterSizeFlag,
|
utils.BloomFilterSizeFlag,
|
||||||
utils.CacheFlag,
|
utils.CacheFlag,
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{
|
||||||
utils.EthStatsURLFlag,
|
utils.EthStatsURLFlag,
|
||||||
utils.IdentityFlag,
|
utils.IdentityFlag,
|
||||||
utils.LightKDFFlag,
|
utils.LightKDFFlag,
|
||||||
utils.EthPeerRequiredBlocksFlag,
|
utils.EthRequiredBlocksFlag,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -250,13 +250,13 @@ var (
|
||||||
Name: "lightkdf",
|
Name: "lightkdf",
|
||||||
Usage: "Reduce key-derivation RAM & CPU usage at some expense of KDF strength",
|
Usage: "Reduce key-derivation RAM & CPU usage at some expense of KDF strength",
|
||||||
}
|
}
|
||||||
EthPeerRequiredBlocksFlag = cli.StringFlag{
|
EthRequiredBlocksFlag = cli.StringFlag{
|
||||||
Name: "eth.requiredblocks",
|
Name: "eth.requiredblocks",
|
||||||
Usage: "Comma separated block number-to-hash mappings to require for peering (<number>=<hash>)",
|
Usage: "Comma separated block number-to-hash mappings to require for peering (<number>=<hash>)",
|
||||||
}
|
}
|
||||||
LegacyWhitelistFlag = cli.StringFlag{
|
LegacyWhitelistFlag = cli.StringFlag{
|
||||||
Name: "whitelist",
|
Name: "whitelist",
|
||||||
Usage: "Comma separated block number-to-hash mappings to enforce (<number>=<hash>) (deprecated in favor of --peer.requiredblocks)",
|
Usage: "Comma separated block number-to-hash mappings to enforce (<number>=<hash>) (deprecated in favor of --eth.requiredblocks)",
|
||||||
}
|
}
|
||||||
BloomFilterSizeFlag = cli.Uint64Flag{
|
BloomFilterSizeFlag = cli.Uint64Flag{
|
||||||
Name: "bloomfilter.size",
|
Name: "bloomfilter.size",
|
||||||
|
|
@ -1499,31 +1499,31 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func setPeerRequiredBlocks(ctx *cli.Context, cfg *ethconfig.Config) {
|
func setRequiredBlocks(ctx *cli.Context, cfg *ethconfig.Config) {
|
||||||
peerRequiredBlocks := ctx.GlobalString(EthPeerRequiredBlocksFlag.Name)
|
requiredBlocks := ctx.GlobalString(EthRequiredBlocksFlag.Name)
|
||||||
|
|
||||||
if peerRequiredBlocks == "" {
|
if requiredBlocks == "" {
|
||||||
if ctx.GlobalIsSet(LegacyWhitelistFlag.Name) {
|
if ctx.GlobalIsSet(LegacyWhitelistFlag.Name) {
|
||||||
log.Warn("The flag --rpc is deprecated and will be removed, please use --peer.requiredblocks")
|
log.Warn("The flag --whitelist is deprecated and will be removed, please use --eth.requiredblocks")
|
||||||
peerRequiredBlocks = ctx.GlobalString(LegacyWhitelistFlag.Name)
|
requiredBlocks = ctx.GlobalString(LegacyWhitelistFlag.Name)
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg.PeerRequiredBlocks = make(map[uint64]common.Hash)
|
cfg.PeerRequiredBlocks = make(map[uint64]common.Hash)
|
||||||
for _, entry := range strings.Split(peerRequiredBlocks, ",") {
|
for _, entry := range strings.Split(requiredBlocks, ",") {
|
||||||
parts := strings.Split(entry, "=")
|
parts := strings.Split(entry, "=")
|
||||||
if len(parts) != 2 {
|
if len(parts) != 2 {
|
||||||
Fatalf("Invalid peer required block entry: %s", entry)
|
Fatalf("Invalid required block entry: %s", entry)
|
||||||
}
|
}
|
||||||
number, err := strconv.ParseUint(parts[0], 0, 64)
|
number, err := strconv.ParseUint(parts[0], 0, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Fatalf("Invalid peer required block number %s: %v", parts[0], err)
|
Fatalf("Invalid required block number %s: %v", parts[0], err)
|
||||||
}
|
}
|
||||||
var hash common.Hash
|
var hash common.Hash
|
||||||
if err = hash.UnmarshalText([]byte(parts[1])); err != nil {
|
if err = hash.UnmarshalText([]byte(parts[1])); err != nil {
|
||||||
Fatalf("Invalid peer required block hash %s: %v", parts[1], err)
|
Fatalf("Invalid required block hash %s: %v", parts[1], err)
|
||||||
}
|
}
|
||||||
cfg.PeerRequiredBlocks[number] = hash
|
cfg.PeerRequiredBlocks[number] = hash
|
||||||
}
|
}
|
||||||
|
|
@ -1592,7 +1592,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
|
||||||
setTxPool(ctx, &cfg.TxPool)
|
setTxPool(ctx, &cfg.TxPool)
|
||||||
setEthash(ctx, cfg)
|
setEthash(ctx, cfg)
|
||||||
setMiner(ctx, &cfg.Miner)
|
setMiner(ctx, &cfg.Miner)
|
||||||
setPeerRequiredBlocks(ctx, cfg)
|
setRequiredBlocks(ctx, cfg)
|
||||||
setLes(ctx, cfg)
|
setLes(ctx, cfg)
|
||||||
|
|
||||||
if ctx.GlobalIsSet(BorLogsFlag.Name) {
|
if ctx.GlobalIsSet(BorLogsFlag.Name) {
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ type Config struct {
|
||||||
|
|
||||||
TxLookupLimit uint64 `toml:",omitempty"` // The maximum number of blocks from head whose tx indices are reserved.
|
TxLookupLimit uint64 `toml:",omitempty"` // The maximum number of blocks from head whose tx indices are reserved.
|
||||||
|
|
||||||
// PeerRequiredBlocks is a set of block number -> hash mappings which must be in the
|
// RequiredBlocks is a set of block number -> hash mappings which must be in the
|
||||||
// canonical chain of all remote peers. Setting the option makes geth verify the
|
// canonical chain of all remote peers. Setting the option makes geth verify the
|
||||||
// presence of these blocks for every new peer connection.
|
// presence of these blocks for every new peer connection.
|
||||||
PeerRequiredBlocks map[uint64]common.Hash `toml:"-"`
|
PeerRequiredBlocks map[uint64]common.Hash `toml:"-"`
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ func (c Config) MarshalTOML() (interface{}, error) {
|
||||||
NoPruning bool
|
NoPruning bool
|
||||||
NoPrefetch bool
|
NoPrefetch bool
|
||||||
TxLookupLimit uint64 `toml:",omitempty"`
|
TxLookupLimit uint64 `toml:",omitempty"`
|
||||||
PeerRequiredBlocks map[uint64]common.Hash `toml:"-"`
|
PeerRequiredBlocks map[uint64]common.Hash `toml:"-"`
|
||||||
LightServ int `toml:",omitempty"`
|
LightServ int `toml:",omitempty"`
|
||||||
LightIngress int `toml:",omitempty"`
|
LightIngress int `toml:",omitempty"`
|
||||||
LightEgress int `toml:",omitempty"`
|
LightEgress int `toml:",omitempty"`
|
||||||
|
|
@ -120,7 +120,7 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
|
||||||
NoPruning *bool
|
NoPruning *bool
|
||||||
NoPrefetch *bool
|
NoPrefetch *bool
|
||||||
TxLookupLimit *uint64 `toml:",omitempty"`
|
TxLookupLimit *uint64 `toml:",omitempty"`
|
||||||
PeerRequiredBlocks map[uint64]common.Hash `toml:"-"`
|
PeerRequiredBlocks map[uint64]common.Hash `toml:"-"`
|
||||||
LightServ *int `toml:",omitempty"`
|
LightServ *int `toml:",omitempty"`
|
||||||
LightIngress *int `toml:",omitempty"`
|
LightIngress *int `toml:",omitempty"`
|
||||||
LightEgress *int `toml:",omitempty"`
|
LightEgress *int `toml:",omitempty"`
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,7 @@ func (cs *chainSyncer) modeAndLocalHead() (downloader.SyncMode, *big.Int) {
|
||||||
// return downloader.SnapSync, td
|
// return downloader.SnapSync, td
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// Nope, we're really full syncing
|
// // Nope, we're really full syncing
|
||||||
// head := cs.handler.chain.CurrentBlock()
|
// head := cs.handler.chain.CurrentBlock()
|
||||||
// td := cs.handler.chain.GetTd(head.Hash(), head.NumberU64())
|
// td := cs.handler.chain.GetTd(head.Hash(), head.NumberU64())
|
||||||
// return downloader.FullSync, td
|
// return downloader.FullSync, td
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue