ReadTd¶
| Source (upstream pre-purge) | Current | |
|---|---|---|
| File | core/rawdb/accessors_chain.go |
accessors_pow.go |
| Symbol | ReadTd |
ReadTd |
| Ref | f4d53133f~1 |
etc/v1.17.3-full-node |
3-way merge — purge → getc ← upstream¶
pre-purge
↗// ReadTd retrieves a block's total difficulty corresponding to the hash.
func ReadTd(db ethdb.Reader, hash common.Hash, number uint64) *big.Int {
data := ReadTdRLP(db, hash, number)
if len(data) == 0 {
return nil
}
td := new(big.Int)
if err := rlp.DecodeBytes(data, td); err != nil {
log.Error("Invalid block total difficulty RLP", "hash", hash, "err", err)
return nil
}
return td
}