mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
feat: add web3_clientVersion rpc method
This commit is contained in:
parent
88bee52e81
commit
7a9af4697e
3 changed files with 22 additions and 2 deletions
|
|
@ -23,6 +23,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/portalnetwork/beacon"
|
||||
"github.com/ethereum/go-ethereum/portalnetwork/history"
|
||||
"github.com/ethereum/go-ethereum/portalnetwork/storage"
|
||||
"github.com/ethereum/go-ethereum/portalnetwork/web3"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"github.com/protolambda/zrnt/eth2/configs"
|
||||
|
|
@ -112,6 +113,12 @@ func startPortalRpcServer(config Config, conn discover.UDPConn, addr string) err
|
|||
return err
|
||||
}
|
||||
|
||||
api := &web3.API{}
|
||||
err = server.RegisterName("web3", api)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if slices.Contains(config.Networks, portalwire.HistoryNetworkName) {
|
||||
err = initHistory(config, server, conn, localNode, discV5)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -978,8 +978,8 @@ Please note that --` + MetricsHTTPFlag.Name + ` must be set to start the server.
|
|||
|
||||
PortalDataCapacityFlag = &cli.Uint64Flag{
|
||||
Name: "data.capacity",
|
||||
Usage: "the capacity of the data stored, the unit is byte",
|
||||
Value: 1000 * 1000 * 1000 * 2, // 2 GB
|
||||
Usage: "the capacity of the data stored, the unit is MB",
|
||||
Value: 1000 * 10, // 10 GB
|
||||
Category: flags.PortalNetworkCategory,
|
||||
}
|
||||
|
||||
|
|
|
|||
13
portalnetwork/web3/api.go
Normal file
13
portalnetwork/web3/api.go
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
package web3
|
||||
|
||||
import "runtime"
|
||||
|
||||
type API struct{}
|
||||
|
||||
func (p *API) ClientVersion() string {
|
||||
// TODO add version
|
||||
name := "Shisui"
|
||||
name += "/" + runtime.GOOS + "-" + runtime.GOARCH
|
||||
name += "/" + runtime.Version()
|
||||
return name
|
||||
}
|
||||
Loading…
Reference in a new issue