Hash returns the keccak256 hash of b's header. The hash is computed on the first call and cached thereafter.
()
| 497 | // Hash returns the keccak256 hash of b's header. |
| 498 | // The hash is computed on the first call and cached thereafter. |
| 499 | func (b *Block) Hash() common.Hash { |
| 500 | if hash := b.hash.Load(); hash != nil { |
| 501 | return hash.(common.Hash) |
| 502 | } |
| 503 | v := b.header.Hash() |
| 504 | b.hash.Store(v) |
| 505 | return v |
| 506 | } |
| 507 | |
| 508 | type Blocks []*Block |
| 509 |