les: address comments

This commit is contained in:
rjl493456442 2020-01-06 21:02:31 +08:00
parent 4ae18842d9
commit 3b7f338887
4 changed files with 6 additions and 6 deletions

View file

@ -42,8 +42,8 @@ type CheckpointOracle struct {
getLocal func(uint64) params.TrustedCheckpoint // Function used to retrieve local checkpoint getLocal func(uint64) params.TrustedCheckpoint // Function used to retrieve local checkpoint
} }
// NewCheckpointOracle returns a checkpoint oracle handler. // New creates a checkpoint oracle handler with given configs and callback.
func NewCheckpointOracle(config *params.CheckpointOracleConfig, getLocal func(uint64) params.TrustedCheckpoint) *CheckpointOracle { func New(config *params.CheckpointOracleConfig, getLocal func(uint64) params.TrustedCheckpoint) *CheckpointOracle {
if config == nil { if config == nil {
log.Info("Checkpoint registrar is not enabled") log.Info("Checkpoint registrar is not enabled")
return nil return nil

View file

@ -124,7 +124,7 @@ func New(ctx *node.ServiceContext, config *eth.Config) (*LightEthereum, error) {
if oracle == nil { if oracle == nil {
oracle = params.CheckpointOracles[genesisHash] oracle = params.CheckpointOracles[genesisHash]
} }
leth.oracle = checkpointoracle.NewCheckpointOracle(oracle, leth.localCheckpoint) leth.oracle = checkpointoracle.New(oracle, leth.localCheckpoint)
// Note: AddChildIndexer starts the update process for the child // Note: AddChildIndexer starts the update process for the child
leth.bloomIndexer.AddChildIndexer(leth.bloomTrieIndexer) leth.bloomIndexer.AddChildIndexer(leth.bloomTrieIndexer)

View file

@ -97,7 +97,7 @@ func NewLesServer(e *eth.Ethereum, config *eth.Config) (*LesServer, error) {
if oracle == nil { if oracle == nil {
oracle = params.CheckpointOracles[e.BlockChain().Genesis().Hash()] oracle = params.CheckpointOracles[e.BlockChain().Genesis().Hash()]
} }
srv.oracle = checkpointoracle.NewCheckpointOracle(oracle, srv.localCheckpoint) srv.oracle = checkpointoracle.New(oracle, srv.localCheckpoint)
// Initialize server capacity management fields. // Initialize server capacity management fields.
srv.defParams = flowcontrol.ServerParams{ srv.defParams = flowcontrol.ServerParams{

View file

@ -195,7 +195,7 @@ func newTestClientHandler(backend *backends.SimulatedBackend, odr *LesOdr, index
BloomRoot: light.GetBloomTrieRoot(db, index, sectionHead), BloomRoot: light.GetBloomTrieRoot(db, index, sectionHead),
} }
} }
oracle = checkpointoracle.NewCheckpointOracle(checkpointConfig, getLocal) oracle = checkpointoracle.New(checkpointConfig, getLocal)
} }
client := &LightEthereum{ client := &LightEthereum{
lesCommons: lesCommons{ lesCommons: lesCommons{
@ -258,7 +258,7 @@ func newTestServerHandler(blocks int, indexers []*core.ChainIndexer, db ethdb.Da
BloomRoot: light.GetBloomTrieRoot(db, index, sectionHead), BloomRoot: light.GetBloomTrieRoot(db, index, sectionHead),
} }
} }
oracle = checkpointoracle.NewCheckpointOracle(checkpointConfig, getLocal) oracle = checkpointoracle.New(checkpointConfig, getLocal)
} }
server := &LesServer{ server := &LesServer{
lesCommons: lesCommons{ lesCommons: lesCommons{