Skip to content

Commit

Permalink
internal/web3ext, les: update clique JS and make it work with the lig…
Browse files Browse the repository at this point in the history
…ht client (ethereum#20318)

Also fix the input formatter on clique_getSnapshot and clique_getSigners
so that integers as well as hex number strings are accepted.
fjl authored Nov 19, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent df206d2 commit 9c6cf96
Showing 3 changed files with 15 additions and 3 deletions.
9 changes: 7 additions & 2 deletions internal/web3ext/web3ext.go
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ web3._extend({
name: 'getSnapshot',
call: 'clique_getSnapshot',
params: 1,
inputFormatter: [null]
inputFormatter: [web3._extend.utils.fromDecimal]
}),
new web3._extend.Method({
name: 'getSnapshotAtHash',
@@ -85,7 +85,7 @@ web3._extend({
name: 'getSigners',
call: 'clique_getSigners',
params: 1,
inputFormatter: [null]
inputFormatter: [web3._extend.utils.fromDecimal]
}),
new web3._extend.Method({
name: 'getSignersAtHash',
@@ -102,6 +102,11 @@ web3._extend({
call: 'clique_discard',
params: 1
}),
new web3._extend.Method({
name: 'status',
call: 'clique_status',
params: 0
}),
],
properties: [
new web3._extend.Property({
4 changes: 3 additions & 1 deletion les/client.go
Original file line number Diff line number Diff line change
@@ -176,7 +176,9 @@ func (s *LightDummyAPI) Mining() bool {
// APIs returns the collection of RPC services the ethereum package offers.
// NOTE, some of these services probably need to be moved to somewhere else.
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",
Version: "1.0",
5 changes: 5 additions & 0 deletions light/lightchain.go
Original file line number Diff line number Diff line change
@@ -143,6 +143,11 @@ func (lc *LightChain) Odr() OdrBackend {
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
// assumes that the chain manager mutex is held.
func (lc *LightChain) loadLastState() error {

0 comments on commit 9c6cf96

Please sign in to comment.