Unverified Commit 9c6cf960 authored by Felix Lange's avatar Felix Lange Committed by GitHub

internal/web3ext, les: update clique JS and make it work with the light client (#20318)

Also fix the input formatter on clique_getSnapshot and clique_getSigners
so that integers as well as hex number strings are accepted.
parent df206d25
...@@ -74,7 +74,7 @@ web3._extend({ ...@@ -74,7 +74,7 @@ web3._extend({
name: 'getSnapshot', name: 'getSnapshot',
call: 'clique_getSnapshot', call: 'clique_getSnapshot',
params: 1, params: 1,
inputFormatter: [null] inputFormatter: [web3._extend.utils.fromDecimal]
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'getSnapshotAtHash', name: 'getSnapshotAtHash',
...@@ -85,7 +85,7 @@ web3._extend({ ...@@ -85,7 +85,7 @@ web3._extend({
name: 'getSigners', name: 'getSigners',
call: 'clique_getSigners', call: 'clique_getSigners',
params: 1, params: 1,
inputFormatter: [null] inputFormatter: [web3._extend.utils.fromDecimal]
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'getSignersAtHash', name: 'getSignersAtHash',
...@@ -102,6 +102,11 @@ web3._extend({ ...@@ -102,6 +102,11 @@ web3._extend({
call: 'clique_discard', call: 'clique_discard',
params: 1 params: 1
}), }),
new web3._extend.Method({
name: 'status',
call: 'clique_status',
params: 0
}),
], ],
properties: [ properties: [
new web3._extend.Property({ new web3._extend.Property({
......
...@@ -176,7 +176,9 @@ func (s *LightDummyAPI) Mining() bool { ...@@ -176,7 +176,9 @@ func (s *LightDummyAPI) Mining() bool {
// APIs returns the collection of RPC services the ethereum package offers. // APIs returns the collection of RPC services the ethereum package offers.
// NOTE, some of these services probably need to be moved to somewhere else. // NOTE, some of these services probably need to be moved to somewhere else.
func (s *LightEthereum) APIs() []rpc.API { func (s *LightEthereum) APIs() []rpc.API {
return append(ethapi.GetAPIs(s.ApiBackend), []rpc.API{ apis := ethapi.GetAPIs(s.ApiBackend)
apis = append(apis, s.engine.APIs(s.BlockChain().HeaderChain())...)
return append(apis, []rpc.API{
{ {
Namespace: "eth", Namespace: "eth",
Version: "1.0", Version: "1.0",
......
...@@ -143,6 +143,11 @@ func (lc *LightChain) Odr() OdrBackend { ...@@ -143,6 +143,11 @@ func (lc *LightChain) Odr() OdrBackend {
return lc.odr return lc.odr
} }
// HeaderChain returns the underlying header chain.
func (lc *LightChain) HeaderChain() *core.HeaderChain {
return lc.hc
}
// loadLastState loads the last known chain state from the database. This method // loadLastState loads the last known chain state from the database. This method
// assumes that the chain manager mutex is held. // assumes that the chain manager mutex is held.
func (lc *LightChain) loadLastState() error { func (lc *LightChain) loadLastState() error {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment