forked from cerc-io/plugeth
ethereum, ethclient: add FeeHistory support (#25403)
Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
co-authored by
Felix Lange
parent
377c7d799f
commit
9ad508018e
@@ -508,6 +508,29 @@ func testStatusFunctions(t *testing.T, client *rpc.Client) {
|
||||
if gasTipCap.Cmp(big.NewInt(234375000)) != 0 {
|
||||
t.Fatalf("unexpected gas tip cap: %v", gasTipCap)
|
||||
}
|
||||
|
||||
// FeeHistory
|
||||
history, err := ec.FeeHistory(context.Background(), 1, big.NewInt(2), []float64{95, 99})
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
want := ðereum.FeeHistory{
|
||||
OldestBlock: big.NewInt(2),
|
||||
Reward: [][]*big.Int{
|
||||
{
|
||||
big.NewInt(234375000),
|
||||
big.NewInt(234375000),
|
||||
},
|
||||
},
|
||||
BaseFee: []*big.Int{
|
||||
big.NewInt(765625000),
|
||||
big.NewInt(671627818),
|
||||
},
|
||||
GasUsedRatio: []float64{0.008912678667376286},
|
||||
}
|
||||
if !reflect.DeepEqual(history, want) {
|
||||
t.Fatalf("FeeHistory result doesn't match expected: (got: %v, want: %v)", history, want)
|
||||
}
|
||||
}
|
||||
|
||||
func testCallContractAtHash(t *testing.T, client *rpc.Client) {
|
||||
|
||||
Reference in New Issue
Block a user