mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 09:37:38 +00:00
internal/ethapi: restore net_version RPC method (#22061)
During the snap and eth refactor, the net_version rpc call was falsely deprecated. This restores the net_version RPC handler as most eth2 nodes and other software depend on it. # Conflicts: # eth/backend.go # les/client.go
This commit is contained in:
parent
cf4c99c435
commit
9c22ecdeb8
@ -1847,12 +1847,13 @@ func (api *PrivateDebugAPI) SetHead(number hexutil.Uint64) {
|
|||||||
|
|
||||||
// PublicNetAPI offers network related RPC methods
|
// PublicNetAPI offers network related RPC methods
|
||||||
type PublicNetAPI struct {
|
type PublicNetAPI struct {
|
||||||
net *p2p.Server
|
net *p2p.Server
|
||||||
|
networkVersion uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPublicNetAPI creates a new net API instance.
|
// NewPublicNetAPI creates a new net API instance.
|
||||||
func NewPublicNetAPI(net *p2p.Server) *PublicNetAPI {
|
func NewPublicNetAPI(net *p2p.Server, networkVersion uint64) *PublicNetAPI {
|
||||||
return &PublicNetAPI{net}
|
return &PublicNetAPI{net, networkVersion}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Listening returns an indication if the node is listening for network connections.
|
// Listening returns an indication if the node is listening for network connections.
|
||||||
@ -1865,6 +1866,11 @@ func (s *PublicNetAPI) PeerCount() hexutil.Uint {
|
|||||||
return hexutil.Uint(s.net.PeerCount())
|
return hexutil.Uint(s.net.PeerCount())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Version returns the current ethereum protocol version.
|
||||||
|
func (s *PublicNetAPI) Version() string {
|
||||||
|
return fmt.Sprintf("%d", s.networkVersion)
|
||||||
|
}
|
||||||
|
|
||||||
// checkTxFee is an internal function used to check whether the fee of
|
// checkTxFee is an internal function used to check whether the fee of
|
||||||
// the given transaction is _reasonable_(under the cap).
|
// the given transaction is _reasonable_(under the cap).
|
||||||
func checkTxFee(gasPrice *big.Int, gas uint64, cap float64) error {
|
func checkTxFee(gasPrice *big.Int, gas uint64, cap float64) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user