aboutsummaryrefslogtreecommitdiffstats
path: root/consensus/ethash/api.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/api.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/api.go')
-rw-r--r--consensus/ethash/api.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/consensus/ethash/api.go b/consensus/ethash/api.go
index a04ea235d..4d8eed416 100644
--- a/consensus/ethash/api.go
+++ b/consensus/ethash/api.go
@@ -37,27 +37,28 @@ type API struct {
// 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
-func (api *API) GetWork() ([3]string, error) {
+// result[3] - hex encoded block number
+func (api *API) GetWork() ([4]string, error) {
if api.ethash.config.PowMode != ModeNormal && api.ethash.config.PowMode != ModeTest {
- return [3]string{}, errors.New("not supported")
+ return [4]string{}, errors.New("not supported")
}
var (
- workCh = make(chan [3]string, 1)
+ workCh = make(chan [4]string, 1)
errc = make(chan error, 1)
)
select {
case api.ethash.fetchWorkCh <- &sealWork{errc: errc, res: workCh}:
case <-api.ethash.exitCh:
- return [3]string{}, errEthashStopped
+ return [4]string{}, errEthashStopped
}
select {
case work := <-workCh:
return work, nil
case err := <-errc:
- return [3]string{}, err
+ return [4]string{}, err
}
}