Make asset precision uint8 everywhere (it was defined as a uint64 and
referenced as a signed short in some places, I think these were artifacts from when precision was stored as 10^x instead of x.
This commit is contained in:
parent
210c109acf
commit
6aa9264477
2 changed files with 4 additions and 4 deletions
|
|
@ -145,7 +145,7 @@ asset asset_object::amount_from_string(string amount_string) const
|
|||
share_type satoshis = 0;
|
||||
|
||||
share_type scaled_precision = 1;
|
||||
for( short i = 0; i < precision; ++i )
|
||||
for( uint8_t i = 0; i < precision; ++i )
|
||||
scaled_precision *= 10;
|
||||
|
||||
const auto decimal_pos = amount_string.find( '.' );
|
||||
|
|
@ -178,7 +178,7 @@ asset asset_object::amount_from_string(string amount_string) const
|
|||
string asset_object::amount_to_string(share_type amount) const
|
||||
{
|
||||
share_type scaled_precision = 1;
|
||||
for( short i = 0; i < precision; ++i )
|
||||
for( uint8_t i = 0; i < precision; ++i )
|
||||
scaled_precision *= 10;
|
||||
assert(scaled_precision > 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -110,8 +110,8 @@ namespace graphene { namespace chain {
|
|||
|
||||
/// Ticker symbol for this asset, i.e. "USD"
|
||||
string symbol;
|
||||
/// Maximum number of digits after the decimal point
|
||||
uint64_t precision;
|
||||
/// Maximum number of digits after the decimal point (must be <= 12)
|
||||
uint8_t precision;
|
||||
/// ID of the account which issued this asset.
|
||||
account_id_type issuer;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue