pegnet / pegnetd

The pegnet daemon to track txs, conversions, etc
Other
13 stars 14 forks source link

Correct 'uint64 values with high bit set are not supported' #101

Closed Emyrk closed 4 years ago

Emyrk commented 4 years ago

This does not affect mainnet as we had no 0 PEG supply blocks

My old comment if someone comes back to this PR in the future:

            // This number is outrageously large since the total cap is the total
            // assets * rates. Assets and rates are 1e8 notation, so a price
            // of $1 puts 1 USD at a market cap of 1e8*1e8.
            // A max int64 is `9223372036854775807` (cannot save top bit in sqlite)
            // So with pUSD, 922.337203685 pUSD will overflow a int64 and break
            // our system. If we have 0 PEG, just set the rate to 0. This means
            // you can only create the first PEG from mining.
            //
            // This only affects local nets that burn before mining starts.

Tl;dr, we need to set to 0 to prevent an overflow