convert getdifficulty to getBlockHeaderBySha to save some cycles.
This commit is contained in:
parent
970c0cdb30
commit
8d930ceed1
1 changed files with 1 additions and 3 deletions
|
@ -930,13 +930,11 @@ func handleGetDifficulty(s *rpcServer, cmd btcjson.Cmd) (interface{}, error) {
|
||||||
rpcsLog.Errorf("Error getting sha: %v", err)
|
rpcsLog.Errorf("Error getting sha: %v", err)
|
||||||
return nil, btcjson.ErrDifficulty
|
return nil, btcjson.ErrDifficulty
|
||||||
}
|
}
|
||||||
blk, err := s.server.db.FetchBlockBySha(sha)
|
blockHeader, err := s.server.db.FetchBlockHeaderBySha(sha)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rpcsLog.Errorf("Error getting block: %v", err)
|
rpcsLog.Errorf("Error getting block: %v", err)
|
||||||
return nil, btcjson.ErrDifficulty
|
return nil, btcjson.ErrDifficulty
|
||||||
}
|
}
|
||||||
blockHeader := &blk.MsgBlock().Header
|
|
||||||
|
|
||||||
return getDifficultyRatio(blockHeader.Bits), nil
|
return getDifficultyRatio(blockHeader.Bits), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue