fix: Use correct chains when checking permissions: mainnet or testnet (#4793)

Fix #18896
This commit is contained in:
Michał Iskierko 2024-02-22 16:17:35 +01:00 committed by GitHub
parent 3959948c4c
commit ba7faea027
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View File

@ -155,9 +155,16 @@ func (m *DefaultTokenManager) GetAllChainIDs() ([]uint64, error) {
return nil, err
}
areTestNetworksEnabled, err := m.tokenManager.RPCClient.NetworkManager.GetTestNetworksEnabled()
if err != nil {
return nil, err
}
chainIDs := make([]uint64, 0)
for _, network := range networks {
chainIDs = append(chainIDs, network.ChainID)
if areTestNetworksEnabled == network.IsTest {
chainIDs = append(chainIDs, network.ChainID)
}
}
return chainIDs, nil
}

View File

@ -320,3 +320,7 @@ func (nm *Manager) GetCombinedNetworks() ([]*CombinedNetwork, error) {
func (nm *Manager) GetConfiguredNetworks() []params.Network {
return nm.configuredNetworks
}
func (nm *Manager) GetTestNetworksEnabled() (result bool, err error) {
return nm.accountsDB.GetTestNetworksEnabled()
}