remoteSealer.makeWork¶
| Source (upstream pre-purge) | Current | |
|---|---|---|
| File | consensus/ethash/sealer.go |
sealer.go |
| Symbol | remoteSealer.makeWork |
remoteSealer.makeWork |
| Ref | dde2da0ef~1 |
etc/v1.17.3-full-node |
3-way merge — purge → getc ← upstream¶
pre-purgecore-geth
↗// makeWork creates a work package for external miner.
//
// The work package consists of 3 strings:
//
// result[0], 32 bytes hex encoded current block header pow-hash
// result[1], 32 bytes hex encoded seed hash used for DAG
// result[2], 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty
// result[3], hex encoded block number
func (s *remoteSealer) makeWork(block *types.Block) {
hash := s.ethash.SealHash(block.Header())
↗ epochLength := calcEpochLength(block.NumberU64(), s.ethash.config.ECIP1099Block)
epoch := calcEpoch(block.NumberU64(), epochLength)
↗ s.currentWork[0] = hash.Hex()
↗ s.currentWork[1] = common.BytesToHash(SeedHash(epoch, epochLength)).Hex()
↗ s.currentWork[2] = common.BytesToHash(new(big.Int).Div(two256, block.Difficulty()).Bytes()).Hex()
s.currentWork[3] = hexutil.EncodeBig(block.Number())
↗ // Trace the seal work fetched by remote sealer.
s.currentBlock = block
s.works[hash] = block
}