Modify gas price statistics (#2947)

* gas price distribution + median + tests

* put histogram in util

* use the util histogram

* remove the default gas price implementation

* histogram rpc

* fix empty corpus

* Add JS ethcore_gasPriceHistogram

* Fix typo (s/types/type/) & subsequent failing test

* Fix return type & formatting

* bucketBounds

* Add jsapi e2e test verification
This commit is contained in:
keorn
2016-10-31 11:57:48 +00:00
committed by Gav Wood
parent 8bf577e0fe
commit 7af20a5db0
17 changed files with 243 additions and 41 deletions

View File

@@ -27,6 +27,16 @@ describe('ethapi.ethcore', () => {
});
});
describe('gasPriceHistogram', () => {
it('returns and translates the target', () => {
return ethapi.ethcore.gasPriceHistogram().then((result) => {
expect(Object.keys(result)).to.deep.equal(['bucketBounds', 'counts']);
expect(result.bucketBounds.length > 0).to.be.true;
expect(result.counts.length > 0).to.be.true;
});
});
});
describe('netChain', () => {
it('returns and the chain', () => {
return ethapi.ethcore.netChain().then((value) => {

View File

@@ -15,7 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import { inAddress, inData, inNumber16 } from '../../format/input';
import { outAddress, outNumber, outPeers } from '../../format/output';
import { outAddress, outHistogram, outNumber, outPeers } from '../../format/output';
export default class Ethcore {
constructor (transport) {
@@ -69,6 +69,12 @@ export default class Ethcore {
.then(outNumber);
}
gasPriceHistogram () {
return this._transport
.execute('ethcore_gasPriceHistogram')
.then(outHistogram);
}
generateSecretPhrase () {
return this._transport
.execute('ethcore_generateSecretPhrase');