Skip to content

Commit 1416a91

Browse files
authored
fix get exchange rate panic (#703)
1 parent 6f666cc commit 1416a91

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

routes/base.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ func (fes *APIServer) GetExchangeRate(ww http.ResponseWriter, rr *http.Request)
9898
nanosPerETH := fes.GetNanosFromETH(big.NewFloat(1), 0)
9999

100100
usdCentsPerDeSoExchangeRate := fes.GetExchangeDeSoPrice()
101-
satoshisPerUnit := lib.NanosPerUnit / fes.GetNanosFromSats(1, 0)
101+
nanosFromSats := fes.GetNanosFromSats(1, 0)
102+
satoshisPerUnit := uint64(0)
103+
if nanosFromSats != 0 {
104+
satoshisPerUnit = lib.NanosPerUnit / fes.GetNanosFromSats(1, 0)
105+
}
102106

103107
res := &GetExchangeRateResponse{
104108
// BTC

0 commit comments

Comments
 (0)