les, les/lespay/client: add service value statistics and API (#20837)
This PR adds service value measurement statistics to the light client. It also adds a private API that makes these statistics accessible. A follow-up PR will add the new server pool which uses these statistics to select servers with good performance. This document describes the function of the new components: https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4 Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
This commit is contained in:
@ -217,7 +217,7 @@ func (n ID) MarshalText() ([]byte, error) {
|
||||
|
||||
// UnmarshalText implements the encoding.TextUnmarshaler interface.
|
||||
func (n *ID) UnmarshalText(text []byte) error {
|
||||
id, err := parseID(string(text))
|
||||
id, err := ParseID(string(text))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -229,14 +229,14 @@ func (n *ID) UnmarshalText(text []byte) error {
|
||||
// The string may be prefixed with 0x.
|
||||
// It panics if the string is not a valid ID.
|
||||
func HexID(in string) ID {
|
||||
id, err := parseID(in)
|
||||
id, err := ParseID(in)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
func parseID(in string) (ID, error) {
|
||||
func ParseID(in string) (ID, error) {
|
||||
var id ID
|
||||
b, err := hex.DecodeString(strings.TrimPrefix(in, "0x"))
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user