aboutsummaryrefslogtreecommitdiffstats
path: root/consensus/ethash/sealer.go
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2018-11-08 23:08:57 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-11-08 23:08:57 +0800
commit144c1c6c52456808428e2b69dbe5c4ebfc3606ca (patch)
tree8bc340d92c7090180931c8bdb9f793965088e862 /consensus/ethash/sealer.go
parentb16cc501a88eb7c36cfd8ee9be1c0c985ef4a7d9 (diff)
downloaddexon-144c1c6c52456808428e2b69dbe5c4ebfc3606ca.tar
dexon-144c1c6c52456808428e2b69dbe5c4ebfc3606ca.tar.gz
dexon-144c1c6c52456808428e2b69dbe5c4ebfc3606ca.tar.bz2
dexon-144c1c6c52456808428e2b69dbe5c4ebfc3606ca.tar.lz
dexon-144c1c6c52456808428e2b69dbe5c4ebfc3606ca.tar.xz
dexon-144c1c6c52456808428e2b69dbe5c4ebfc3606ca.tar.zst
dexon-144c1c6c52456808428e2b69dbe5c4ebfc3606ca.zip
consensus: extend getWork API with block number (#18038)
Diffstat (limited to 'consensus/ethash/sealer.go')
-rw-r--r--consensus/ethash/sealer.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/consensus/ethash/sealer.go b/consensus/ethash/sealer.go
index 06c98a781..3a0919ca9 100644
--- a/consensus/ethash/sealer.go
+++ b/consensus/ethash/sealer.go
@@ -30,6 +30,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
@@ -193,7 +194,7 @@ func (ethash *Ethash) remote(notify []string, noverify bool) {
results chan<- *types.Block
currentBlock *types.Block
- currentWork [3]string
+ currentWork [4]string
notifyTransport = &http.Transport{}
notifyClient = &http.Client{
@@ -234,12 +235,14 @@ func (ethash *Ethash) remote(notify []string, noverify bool) {
// 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
makeWork := func(block *types.Block) {
hash := ethash.SealHash(block.Header())
currentWork[0] = hash.Hex()
currentWork[1] = common.BytesToHash(SeedHash(block.NumberU64())).Hex()
currentWork[2] = common.BytesToHash(new(big.Int).Div(two256, block.Difficulty()).Bytes()).Hex()
+ currentWork[3] = hexutil.EncodeBig(block.Number())
// Trace the seal work fetched by remote sealer.
currentBlock = block