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:
Felföldi Zsolt
2020-04-09 11:55:32 +02:00
committed by GitHub
parent 15540ae992
commit 0851646e48
17 changed files with 2142 additions and 38 deletions

View File

@ -33,6 +33,7 @@ var Modules = map[string]string{
"swarmfs": SwarmfsJs,
"txpool": TxpoolJs,
"les": LESJs,
"lespay": LESPayJs,
}
const ChequebookJs = `
@ -856,3 +857,34 @@ web3._extend({
]
});
`
const LESPayJs = `
web3._extend({
property: 'lespay',
methods:
[
new web3._extend.Method({
name: 'distribution',
call: 'lespay_distribution',
params: 2
}),
new web3._extend.Method({
name: 'timeout',
call: 'lespay_timeout',
params: 2
}),
new web3._extend.Method({
name: 'value',
call: 'lespay_value',
params: 2
}),
],
properties:
[
new web3._extend.Property({
name: 'requestStats',
getter: 'lespay_requestStats'
}),
]
});
`