Skip to content

Commit 3d43cd3

Browse files
committed
eth/gasprice: sanity check ratio values (ethereum#31270)
1 parent 4e753f3 commit 3d43cd3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

eth/gasprice/feehistory_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ func TestFeeHistory(t *testing.T) {
8383
if len(ratio) != c.expCount {
8484
t.Fatalf("Test case %d: gasUsedRatio array length mismatch, want %d, got %d", i, c.expCount, len(ratio))
8585
}
86+
for _, ratio := range ratio {
87+
if ratio > 1 {
88+
t.Fatalf("Test case %d: gasUsedRatio greater than 1, got %f", i, ratio)
89+
}
90+
}
8691
if err != c.expErr && !errors.Is(err, c.expErr) {
8792
t.Fatalf("Test case %d: error mismatch, want %v, got %v", i, c.expErr, err)
8893
}

0 commit comments

Comments
 (0)