-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(monitor/xfeemngr): tiered buffers (#2492)
Use tiers instead of offset / tolerance. issue: none
- Loading branch information
1 parent
d73b69a
commit fc989e4
Showing
6 changed files
with
56 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package gasprice | ||
|
||
// buffer will be the lowest tier that is higher than the live gas price. | ||
var tiers = []uint64{ | ||
gwei(0.001), | ||
gwei(0.1), | ||
gwei(1), | ||
gwei(5), | ||
gwei(10), | ||
gwei(25), | ||
gwei(50), | ||
gwei(100), | ||
gwei(200), | ||
} | ||
|
||
func Tiers() []uint64 { | ||
return tiers | ||
} | ||
|
||
func Tier(live uint64) uint64 { | ||
for _, p := range tiers { | ||
if p > live { | ||
return p | ||
} | ||
} | ||
|
||
return tiers[len(tiers)-1] | ||
} | ||
|
||
func gwei(p float64) uint64 { | ||
return uint64(p * 1e9) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters