Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth/gasprice: lighter gas price oracle for light client #20409

Merged
merged 7 commits into from
Jul 3, 2020

Conversation

rjl493456442
Copy link
Member

@rjl493456442 rjl493456442 commented Nov 29, 2019

This PR is mainly for reducing the cost for light client to generate a recommended gas price.

The current mechanism for suggesting price is:

  • retrieve recent 20 blocks
  • get the lowest gas price of these blocks
  • sort the price array and return the middle(60%) one

It works perfectly for full node which has all blocks locally. However it's super expensive for light client.

For light client, it needs to retrieve block bodies from the network. Bodies are super heavy, so it's just too expensive.

The PR changes the default options for light client. So that now light client only retrieves 2 latest blocks.
But in order to collect more sample transactions, the 3 lowest prices are collected from each block.

Besides, this PR also changes the behavior for empty blocks. If the block is empty, we reuse the lastest price for sampling

@rjl493456442 rjl493456442 changed the title cmd, eth, les: ligher gas price oracle for light client cmd, eth, les: lighter gas price oracle for light client Dec 3, 2019
eth/gasprice/gasprice.go Outdated Show resolved Hide resolved
eth/gasprice/gasprice.go Outdated Show resolved Hide resolved
eth/gasprice/gasprice.go Outdated Show resolved Hide resolved
eth/gasprice/gasprice.go Outdated Show resolved Hide resolved
eth/config.go Outdated Show resolved Hide resolved
eth/gasprice/gasprice.go Show resolved Hide resolved
eth/gasprice/gasprice.go Outdated Show resolved Hide resolved
@rjl493456442 rjl493456442 force-pushed the gasprice-oracle branch 2 times, most recently from e86000e to de1b636 Compare April 19, 2020 05:46
@rjl493456442
Copy link
Member Author

@zsfelfoldi Has addressed your comments, please check again

eth/gasprice/gasprice.go Outdated Show resolved Hide resolved
@rjl493456442
Copy link
Member Author

@zsfelfoldi I fixed the issue, please take another look :)

@rjl493456442
Copy link
Member Author

@fjl The PR is rebased. Please check it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants