Skip to content

fix: nil currency error #2151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion miner/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,10 @@ func createConversionFunctions(sysCtx *core.SysContractCallCtx, chain *core.Bloc
}
toCeloFn := func(amount *big.Int, feeCurrency *common.Address) *big.Int {
curr, _ := currencyManager.GetCurrency(feeCurrency)
return curr.ToCELO(amount)
if curr != nil {
return curr.ToCELO(amount)
}
return nil
}

return baseFeeFn, toCeloFn
Expand Down
2 changes: 2 additions & 0 deletions p2p/discover/v4_udp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ func startLocalhostV4(t *testing.T, cfg Config) *UDPv4 {
if err != nil {
t.Fatal(err)
}
defer socket.Close()

realaddr := socket.LocalAddr().(*net.UDPAddr)
ln.SetStaticIP(realaddr.IP)
ln.SetFallbackUDP(realaddr.Port)
Expand Down
2 changes: 2 additions & 0 deletions p2p/discover/v5_udp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ func startLocalhostV5(t *testing.T, cfg Config) *UDPv5 {
if err != nil {
t.Fatal(err)
}
defer socket.Close()

realaddr := socket.LocalAddr().(*net.UDPAddr)
ln.SetStaticIP(realaddr.IP)
ln.Set(enr.UDP(realaddr.Port))
Expand Down
2 changes: 2 additions & 0 deletions p2p/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,8 @@ func (srv *Server) setupDiscovery() error {
if err != nil {
return err
}
defer conn.Close()

realaddr := conn.LocalAddr().(*net.UDPAddr)
srv.log.Debug("UDP listener up", "addr", realaddr)
if srv.NAT != nil {
Expand Down