op-geth/eth/gasprice
gary rong 61270e5e1c
eth/gasprice: lighter gas price oracle for light client (#20409)
This PR reduces the bandwidth used by the light client to compute the
recommended gas price. The current mechanism for suggesting the price is:

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

This works for full nodes, which have all blocks available locally.
However, this is very expensive for the light client because the light
client needs to retrieve block bodies from the network.

The PR changes the default options for light client. With the new config,
the light client only retrieves the two latest blocks, but in order to
collect more sample transactions, the 3 lowest prices are collected from
each block.

This PR also changes the behavior for empty blocks. If the block is empty,
the lastest price is reused for sampling.
2020-07-03 14:50:35 +02:00
..
gasprice.go eth/gasprice: lighter gas price oracle for light client (#20409) 2020-07-03 14:50:35 +02:00
gasprice_test.go eth/gasprice: lighter gas price oracle for light client (#20409) 2020-07-03 14:50:35 +02:00