aboutsummaryrefslogtreecommitdiffstats
path: root/internal/web3ext
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2018-08-03 16:33:37 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-08-03 16:33:37 +0800
commit51db5975cc5fb88db6a0dba1826b534fd4df29d7 (patch)
tree930f5a66d52c9bdcecd5596d7630fb48b0982cfd /internal/web3ext
parent70176cda0eedbb4ec9cde867e8f6cde63efa5a12 (diff)
downloaddexon-51db5975cc5fb88db6a0dba1826b534fd4df29d7.tar.gz
dexon-51db5975cc5fb88db6a0dba1826b534fd4df29d7.tar.zst
dexon-51db5975cc5fb88db6a0dba1826b534fd4df29d7.zip
consensus/ethash: move remote agent logic to ethash internal (#15853)
* consensus/ethash: start remote ggoroutine to handle remote mining * consensus/ethash: expose remote miner api * consensus/ethash: expose submitHashrate api * miner, ethash: push empty block to sealer without waiting execution * consensus, internal: add getHashrate API for ethash * consensus: add three method for consensus interface * miner: expose consensus engine running status to miner * eth, miner: specify etherbase when miner created * miner: commit new work when consensus engine is started * consensus, miner: fix some logics * all: delete useless interfaces * consensus: polish a bit
Diffstat (limited to 'internal/web3ext')
-rw-r--r--internal/web3ext/web3ext.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go
index 89ebceec7..c2e0cd3f5 100644
--- a/internal/web3ext/web3ext.go
+++ b/internal/web3ext/web3ext.go
@@ -21,6 +21,7 @@ var Modules = map[string]string{
"admin": Admin_JS,
"chequebook": Chequebook_JS,
"clique": Clique_JS,
+ "ethash": Ethash_JS,
"debug": Debug_JS,
"eth": Eth_JS,
"miner": Miner_JS,
@@ -109,6 +110,34 @@ web3._extend({
});
`
+const Ethash_JS = `
+web3._extend({
+ property: 'ethash',
+ methods: [
+ new web3._extend.Method({
+ name: 'getWork',
+ call: 'ethash_getWork',
+ params: 0
+ }),
+ new web3._extend.Method({
+ name: 'getHashrate',
+ call: 'ethash_getHashrate',
+ params: 0
+ }),
+ new web3._extend.Method({
+ name: 'submitWork',
+ call: 'ethash_submitWork',
+ params: 3,
+ }),
+ new web3._extend.Method({
+ name: 'submitHashRate',
+ call: 'ethash_submitHashRate',
+ params: 2,
+ }),
+ ]
+});
+`
+
const Admin_JS = `
web3._extend({
property: 'admin',