mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 09:37:38 +00:00
fix on number of samples for blocks (#5826)
eth_gasPrice(): A maximum of 3 samples should be taken per block (see sample const) The getBlockPrices() function takes 3 samples on the first block and one on the others. In the check s.Len() >= limit s.Len() after first block will contain 3 samples and so the loop will be executed only one time for each block NOT three times
This commit is contained in:
parent
4509f496c6
commit
21d24a20a0
@ -254,7 +254,8 @@ func (oracle *Oracle) getBlockPrices(ctx context.Context, blockNum uint64, limit
|
|||||||
txs := newTransactionsByGasPrice(plainTxs, baseFee)
|
txs := newTransactionsByGasPrice(plainTxs, baseFee)
|
||||||
heap.Init(&txs)
|
heap.Init(&txs)
|
||||||
|
|
||||||
for txs.Len() > 0 {
|
count := 0
|
||||||
|
for count < limit && txs.Len() > 0 {
|
||||||
tx := heap.Pop(&txs).(types.Transaction)
|
tx := heap.Pop(&txs).(types.Transaction)
|
||||||
tip := tx.GetEffectiveGasTip(baseFee)
|
tip := tx.GetEffectiveGasTip(baseFee)
|
||||||
if ignoreUnder != nil && tip.Lt(ignoreUnder) {
|
if ignoreUnder != nil && tip.Lt(ignoreUnder) {
|
||||||
@ -263,9 +264,7 @@ func (oracle *Oracle) getBlockPrices(ctx context.Context, blockNum uint64, limit
|
|||||||
sender, _ := tx.GetSender()
|
sender, _ := tx.GetSender()
|
||||||
if err == nil && sender != block.Coinbase() {
|
if err == nil && sender != block.Coinbase() {
|
||||||
heap.Push(s, tip)
|
heap.Push(s, tip)
|
||||||
if s.Len() >= limit {
|
count = count + 1
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user