Commit 84ef7311 authored by vicotor's avatar vicotor

profile code

parent 7006abff
...@@ -48,7 +48,7 @@ func (d *Dao) GetLatestBockHash(chain *config.ChainConfig) (hash string, err err ...@@ -48,7 +48,7 @@ func (d *Dao) GetLatestBockHash(chain *config.ChainConfig) (hash string, err err
if !ok { if !ok {
return "", errors.New("chain client not support") return "", errors.New("chain client not support")
} }
block, err := chainInfo.cli.BlockByNumber(ctx, nil) block, err := chainInfo.cli.HeaderByNumber(ctx, nil)
if err != nil { if err != nil {
return return
} }
...@@ -64,9 +64,9 @@ func (d *Dao) GetBlockTime(chain *config.ChainConfig, height int64) (timestamp i ...@@ -64,9 +64,9 @@ func (d *Dao) GetBlockTime(chain *config.ChainConfig, height int64) (timestamp i
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel() defer cancel()
block, err := chainInfo.cli.BlockByNumber(ctx, big.NewInt(int64(height))) block, err := chainInfo.cli.HeaderByNumber(ctx, big.NewInt(int64(height)))
if err == nil { if err == nil {
return int64(block.Time()), nil return int64(block.Time), nil
} }
} }
return return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment