Skip to content

Commit

Permalink
Add define for init mana #3589
Browse files Browse the repository at this point in the history
  • Loading branch information
mvandeberg committed Feb 11, 2020
1 parent 700c9e5 commit e87be9f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions libraries/plugins/rc/rc_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
// TODO: What should this value be for testnet?
#define STEEM_HISTORICAL_ACCOUNT_CREATION_ADJUSTMENT 2020748973

// Sentinel value for newley created accounts.
#define RC_PLUGIN_DEFAULT_INITIALIZED_MANA std::numeric_limits< int64_t >::max()

#ifndef IS_TEST_NET
#define STEEM_HF20_BLOCK_NUM 26256743
#endif
Expand Down Expand Up @@ -159,7 +162,7 @@ void create_rc_account( database& db, uint32_t now, const account_object& accoun
// The first time the rc account's mana is regenerated, it will be
// capped to the actual max value. This allows creating account's
// in the past and not begin tracking RCs until later (Issue #3589)
rca.rc_manabar.current_mana = std::numeric_limits< int64_t >::max();
rca.rc_manabar.current_mana = RC_PLUGIN_DEFAULT_INITIALIZED_MANA;
rca.last_max_rc = max_rc;

rca.indel_slots[ STEEM_RC_CREATOR_SLOT_NUM ] = creator;
Expand Down Expand Up @@ -706,8 +709,8 @@ struct pre_apply_operation_visitor

try {

// current_mana == numeric_limits< int64_t >::max() is a unique case for an newly created account
if( mbparams.max_mana != rc_account.last_max_rc && rc_account.rc_manabar.current_mana != std::numeric_limits< int64_t >::max() )
// current_mana == RC_PLUGIN_DEFAULT_INITIALIZED_MANA is a unique case for an newly created account
if( mbparams.max_mana != rc_account.last_max_rc && rc_account.rc_manabar.current_mana != RC_PLUGIN_DEFAULT_INITIALIZED_MANA )
{
if( !_skip.skip_reject_unknown_delta_vests )
{
Expand Down Expand Up @@ -1251,7 +1254,7 @@ struct post_apply_operation_visitor
// The first time the rc account's mana is regenerated, it will be
// capped to the actual max value. This allows creating account's
// in the past and not begin tracking RCs until later (Issue #3589)
rca.rc_manabar.current_mana = std::numeric_limits< int64_t >::max();
rca.rc_manabar.current_mana = RC_PLUGIN_DEFAULT_INITIALIZED_MANA;
rca.last_max_rc = max_rc;

rca.indel_slots[ STEEM_RC_CREATOR_SLOT_NUM ] = nai;
Expand Down

0 comments on commit e87be9f

Please sign in to comment.