mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
Small refactor to re-use isChainIDOneOf function
This commit is contained in:
parent
1b285b8c81
commit
bbcf323c96
1 changed files with 16 additions and 10 deletions
|
|
@ -326,15 +326,17 @@ var bscMainnetChainID = big.NewInt(56)
|
||||||
var bscTestnetChainID = big.NewInt(97)
|
var bscTestnetChainID = big.NewInt(97)
|
||||||
|
|
||||||
func chainNeedsLegacyBackwardCompatibility(id *big.Int) bool {
|
func chainNeedsLegacyBackwardCompatibility(id *big.Int) bool {
|
||||||
return id.Cmp(mainnetChainID) == 0 ||
|
return isChainIDOneOf(id,
|
||||||
id.Cmp(goerliChainID) == 0 ||
|
mainnetChainID,
|
||||||
id.Cmp(sepoliaChainID) == 0 ||
|
goerliChainID,
|
||||||
id.Cmp(holeskyChainID) == 0 ||
|
sepoliaChainID,
|
||||||
id.Cmp(polygonMainnetChainID) == 0 ||
|
holeskyChainID,
|
||||||
id.Cmp(polygonMumbaiChainID) == 0 ||
|
polygonMainnetChainID,
|
||||||
id.Cmp(polygonAmoyChainID) == 0 ||
|
polygonMumbaiChainID,
|
||||||
id.Cmp(bscMainnetChainID) == 0 ||
|
polygonAmoyChainID,
|
||||||
id.Cmp(bscTestnetChainID) == 0
|
bscMainnetChainID,
|
||||||
|
bscTestnetChainID,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Firehose) OnBlockStart(event tracing.BlockEvent) {
|
func (f *Firehose) OnBlockStart(event tracing.BlockEvent) {
|
||||||
|
|
@ -1686,8 +1688,12 @@ func (f *Firehose) ensureInSystemCall() {
|
||||||
func (f *Firehose) isChainOneOf(chainIDs ...*big.Int) bool {
|
func (f *Firehose) isChainOneOf(chainIDs ...*big.Int) bool {
|
||||||
f.ensureBlockChainInit()
|
f.ensureBlockChainInit()
|
||||||
|
|
||||||
|
return isChainIDOneOf(f.chainConfig.ChainID, chainIDs...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func isChainIDOneOf(actualChainID *big.Int, chainIDs ...*big.Int) bool {
|
||||||
for _, chainID := range chainIDs {
|
for _, chainID := range chainIDs {
|
||||||
if f.chainConfig.ChainID.Cmp(chainID) == 0 {
|
if actualChainID.Cmp(chainID) == 0 {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue