Skip to content
This repository was archived by the owner on May 21, 2024. It is now read-only.

Commit 61b32fd

Browse files
fjlelizabethengelman
authored andcommitted
internal/web3ext, les: update clique JS and make it work with the light 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.
1 parent eb08eec commit 61b32fd

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

internal/web3ext/web3ext.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ web3._extend({
7474
name: 'getSnapshot',
7575
call: 'clique_getSnapshot',
7676
params: 1,
77-
inputFormatter: [null]
77+
inputFormatter: [web3._extend.utils.fromDecimal]
7878
}),
7979
new web3._extend.Method({
8080
name: 'getSnapshotAtHash',
@@ -85,7 +85,7 @@ web3._extend({
8585
name: 'getSigners',
8686
call: 'clique_getSigners',
8787
params: 1,
88-
inputFormatter: [null]
88+
inputFormatter: [web3._extend.utils.fromDecimal]
8989
}),
9090
new web3._extend.Method({
9191
name: 'getSignersAtHash',
@@ -102,6 +102,11 @@ web3._extend({
102102
call: 'clique_discard',
103103
params: 1
104104
}),
105+
new web3._extend.Method({
106+
name: 'status',
107+
call: 'clique_status',
108+
params: 0
109+
}),
105110
],
106111
properties: [
107112
new web3._extend.Property({

les/client.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ func (s *LightDummyAPI) Mining() bool {
176176
// APIs returns the collection of RPC services the ethereum package offers.
177177
// NOTE, some of these services probably need to be moved to somewhere else.
178178
func (s *LightEthereum) APIs() []rpc.API {
179-
return append(ethapi.GetAPIs(s.ApiBackend), []rpc.API{
179+
apis := ethapi.GetAPIs(s.ApiBackend)
180+
apis = append(apis, s.engine.APIs(s.BlockChain().HeaderChain())...)
181+
return append(apis, []rpc.API{
180182
{
181183
Namespace: "eth",
182184
Version: "1.0",

light/lightchain.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ func (lc *LightChain) Odr() OdrBackend {
143143
return lc.odr
144144
}
145145

146+
// HeaderChain returns the underlying header chain.
147+
func (lc *LightChain) HeaderChain() *core.HeaderChain {
148+
return lc.hc
149+
}
150+
146151
// loadLastState loads the last known chain state from the database. This method
147152
// assumes that the chain manager mutex is held.
148153
func (lc *LightChain) loadLastState() error {

0 commit comments

Comments
 (0)