remove call api from rpc to consensus posv and add again with clique

This commit is contained in:
Nguyen Ba Tam 2018-08-10 10:32:00 +07:00 committed by Tuna
parent 34f82ad7b1
commit b8f6655d37
2 changed files with 11 additions and 16 deletions

View file

@ -819,12 +819,7 @@ func CalcDifficulty(snap *Snapshot, signer common.Address) *big.Int {
// APIs implements consensus.Engine, returning the user facing RPC API to allow // APIs implements consensus.Engine, returning the user facing RPC API to allow
// controlling the signer voting. // controlling the signer voting.
func (c *Posv) APIs(chain consensus.ChainReader) []rpc.API { func (c *Posv) APIs(chain consensus.ChainReader) []rpc.API {
return []rpc.API{{ return []rpc.API{}
Namespace: "posv",
Version: "1.0",
Service: &API{chain: chain, posv: c},
Public: false,
}}
} }
func (c *Posv) RecoverSigner(header *types.Header) (common.Address, error) { func (c *Posv) RecoverSigner(header *types.Header) (common.Address, error) {

View file

@ -20,7 +20,7 @@ package web3ext
var Modules = map[string]string{ var Modules = map[string]string{
"admin": Admin_JS, "admin": Admin_JS,
"chequebook": Chequebook_JS, "chequebook": Chequebook_JS,
"posv": Posv_JS, "clique": Clique_JS,
"debug": Debug_JS, "debug": Debug_JS,
"eth": Eth_JS, "eth": Eth_JS,
"miner": Miner_JS, "miner": Miner_JS,
@ -63,47 +63,47 @@ web3._extend({
}); });
` `
const Posv_JS = ` const Clique_JS = `
web3._extend({ web3._extend({
property: 'posv', property: 'clique',
methods: [ methods: [
new web3._extend.Method({ new web3._extend.Method({
name: 'getSnapshot', name: 'getSnapshot',
call: 'posv_getSnapshot', call: 'clique_getSnapshot',
params: 1, params: 1,
inputFormatter: [null] inputFormatter: [null]
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'getSnapshotAtHash', name: 'getSnapshotAtHash',
call: 'posv_getSnapshotAtHash', call: 'clique_getSnapshotAtHash',
params: 1 params: 1
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'getSigners', name: 'getSigners',
call: 'posv_getSigners', call: 'clique_getSigners',
params: 1, params: 1,
inputFormatter: [null] inputFormatter: [null]
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'getSignersAtHash', name: 'getSignersAtHash',
call: 'posv_getSignersAtHash', call: 'clique_getSignersAtHash',
params: 1 params: 1
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'propose', name: 'propose',
call: 'posv_propose', call: 'clique_propose',
params: 2 params: 2
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'discard', name: 'discard',
call: 'posv_discard', call: 'clique_discard',
params: 1 params: 1
}), }),
], ],
properties: [ properties: [
new web3._extend.Property({ new web3._extend.Property({
name: 'proposals', name: 'proposals',
getter: 'posv_proposals' getter: 'clique_proposals'
}), }),
] ]
}); });