MCPcopy Create free account
hub / github.com/CPChain/chain / sigHash

Function sigHash

types/block.go:167–192  ·  view source on GitHub ↗

sigHash returns hash of header

(header *Header)

Source from the content-addressed store, hash-verified

165
166// sigHash returns hash of header
167func sigHash(header *Header) (hash common.Hash) {
168 hasher := sha3.NewKeccak256()
169 err := rlp.Encode(hasher, []interface{}{
170 header.ParentHash,
171 header.Coinbase,
172 header.StateRoot,
173 header.TxsRoot,
174 header.ReceiptsRoot,
175 header.LogsBloom,
176 header.Number,
177 header.GasLimit,
178 header.GasUsed,
179 header.Time,
180 header.Dpor.Proposers,
181 header.Dpor.Validators,
182 header.Extra,
183 common.Hash{},
184 BlockNonce{},
185 })
186 if err != nil {
187 log.Error("invalid hash encoding", "error", err)
188 return common.Hash{}
189 }
190 hasher.Sum(hash[:0])
191 return hash
192}
193
194// HashNoNonce returns the hash which is used as input for the proof-of-work search.
195func (h *Header) HashNoNonce() common.Hash {

Callers 1

HashMethod · 0.70

Calls 1

ErrorMethod · 0.65

Tested by

no test coverage detected