Merge branch 'master' of github.com:cryptonomex/graphene
This commit is contained in:
commit
ddb3ee9676
3 changed files with 3 additions and 115 deletions
|
|
@ -72,21 +72,6 @@ void database::adjust_balance(account_id_type account, asset delta )
|
||||||
|
|
||||||
} FC_CAPTURE_AND_RETHROW( (account)(delta) ) }
|
} FC_CAPTURE_AND_RETHROW( (account)(delta) ) }
|
||||||
|
|
||||||
void database::adjust_balance(const account_object& account, asset delta )
|
|
||||||
{
|
|
||||||
adjust_balance( account.id, delta);
|
|
||||||
}
|
|
||||||
|
|
||||||
void database::adjust_core_in_orders( const account_object& acnt, asset delta )
|
|
||||||
{
|
|
||||||
if( delta.asset_id == asset_id_type(0) && delta.amount != 0 )
|
|
||||||
{
|
|
||||||
modify( acnt.statistics(*this), [&](account_statistics_object& stat){
|
|
||||||
stat.total_core_in_orders += delta.amount;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
optional< vesting_balance_id_type > database::deposit_lazy_vesting(
|
optional< vesting_balance_id_type > database::deposit_lazy_vesting(
|
||||||
const optional< vesting_balance_id_type >& ovbid,
|
const optional< vesting_balance_id_type >& ovbid,
|
||||||
share_type amount, uint32_t req_vesting_seconds,
|
share_type amount, uint32_t req_vesting_seconds,
|
||||||
|
|
|
||||||
|
|
@ -322,13 +322,6 @@ namespace graphene { namespace chain {
|
||||||
* @param delta Asset ID and amount to adjust balance by
|
* @param delta Asset ID and amount to adjust balance by
|
||||||
*/
|
*/
|
||||||
void adjust_balance(account_id_type account, asset delta);
|
void adjust_balance(account_id_type account, asset delta);
|
||||||
/// This is an overloaded method.
|
|
||||||
void adjust_balance(const account_object& account, asset delta);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If delta.asset_id is a core asset, adjusts account statistics
|
|
||||||
*/
|
|
||||||
void adjust_core_in_orders( const account_object& acnt, asset delta );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Helper to make lazy deposit to CDD VBO.
|
* @brief Helper to make lazy deposit to CDD VBO.
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
namespace graphene { namespace chain {
|
namespace graphene { namespace chain {
|
||||||
|
|
||||||
|
|
||||||
uint64_t base_operation::calculate_data_fee( uint64_t bytes, uint64_t price_per_kbyte )
|
uint64_t base_operation::calculate_data_fee( uint64_t bytes, uint64_t price_per_kbyte )
|
||||||
{
|
{
|
||||||
auto result = (fc::uint128(bytes) * price_per_kbyte) / 1024;
|
auto result = (fc::uint128(bytes) * price_per_kbyte) / 1024;
|
||||||
|
|
@ -27,10 +26,7 @@ uint64_t base_operation::calculate_data_fee( uint64_t bytes, uint64_t price_per_
|
||||||
return result.to_uint64();
|
return result.to_uint64();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void balance_claim_operation::validate()const
|
||||||
|
|
||||||
|
|
||||||
void balance_claim_operation::validate()const
|
|
||||||
{
|
{
|
||||||
FC_ASSERT( fee == asset() );
|
FC_ASSERT( fee == asset() );
|
||||||
FC_ASSERT( balance_owner_key != public_key_type() );
|
FC_ASSERT( balance_owner_key != public_key_type() );
|
||||||
|
|
@ -54,88 +50,9 @@ struct required_auth_visitor
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct required_active_visitor
|
|
||||||
{
|
|
||||||
typedef void result_type;
|
|
||||||
|
|
||||||
flat_set<account_id_type>& result;
|
|
||||||
|
|
||||||
required_active_visitor( flat_set<account_id_type>& r ):result(r){}
|
|
||||||
|
|
||||||
/** for most operations this is just the fee payer */
|
|
||||||
template<typename T>
|
|
||||||
void operator()(const T& o)const
|
|
||||||
{
|
|
||||||
result.insert( o.fee_payer() );
|
|
||||||
}
|
|
||||||
void operator()(const account_update_operation& o)const
|
|
||||||
{
|
|
||||||
/// if owner authority is required, no active authority is required
|
|
||||||
if( !(o.owner || o.active) )
|
|
||||||
result.insert( o.fee_payer() );
|
|
||||||
}
|
|
||||||
void operator()( const proposal_delete_operation& o )const
|
|
||||||
{
|
|
||||||
if( !o.using_owner_authority )
|
|
||||||
result.insert( o.fee_payer() );
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator()( const proposal_update_operation& o )const
|
|
||||||
{
|
|
||||||
result.insert( o.fee_payer() );
|
|
||||||
for( auto id : o.active_approvals_to_add )
|
|
||||||
result.insert(id);
|
|
||||||
for( auto id : o.active_approvals_to_remove )
|
|
||||||
result.insert(id);
|
|
||||||
}
|
|
||||||
void operator()( const custom_operation& o )const
|
|
||||||
{
|
|
||||||
result.insert( o.required_auths.begin(), o.required_auths.end() );
|
|
||||||
}
|
|
||||||
void operator()( const assert_operation& o )const
|
|
||||||
{
|
|
||||||
result.insert( o.fee_payer() );
|
|
||||||
result.insert( o.required_auths.begin(), o.required_auths.end() );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct required_owner_visitor
|
|
||||||
{
|
|
||||||
typedef void result_type;
|
|
||||||
|
|
||||||
flat_set<account_id_type>& result;
|
|
||||||
|
|
||||||
required_owner_visitor( flat_set<account_id_type>& r ):result(r){}
|
|
||||||
|
|
||||||
/** for most operations this is a no-op */
|
|
||||||
template<typename T>
|
|
||||||
void operator()(const T& o)const {}
|
|
||||||
|
|
||||||
void operator()(const account_update_operation& o)const
|
|
||||||
{
|
|
||||||
if( o.owner || o.active )
|
|
||||||
result.insert( o.account );
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator()( const proposal_delete_operation& o )const
|
|
||||||
{
|
|
||||||
if( o.using_owner_authority )
|
|
||||||
result.insert( o.fee_payer() );
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator()( const proposal_update_operation& o )const
|
|
||||||
{
|
|
||||||
for( auto id : o.owner_approvals_to_add )
|
|
||||||
result.insert(id);
|
|
||||||
for( auto id : o.owner_approvals_to_remove )
|
|
||||||
result.insert(id);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct get_impacted_account_visitor
|
struct get_impacted_account_visitor
|
||||||
{
|
{
|
||||||
flat_set<account_id_type>& _impacted;
|
flat_set<account_id_type>& _impacted;
|
||||||
get_impacted_account_visitor( flat_set<account_id_type>& impact ):_impacted(impact) {}
|
get_impacted_account_visitor( flat_set<account_id_type>& impact ):_impacted(impact) {}
|
||||||
typedef void result_type;
|
typedef void result_type;
|
||||||
|
|
||||||
|
|
@ -145,6 +62,7 @@ struct get_impacted_account_visitor
|
||||||
o.get_impacted_accounts( _impacted );
|
o.get_impacted_accounts( _impacted );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void operation_get_impacted_accounts( const operation& op, flat_set<account_id_type>& result )
|
void operation_get_impacted_accounts( const operation& op, flat_set<account_id_type>& result )
|
||||||
{
|
{
|
||||||
op.visit( get_impacted_account_visitor( result ) );
|
op.visit( get_impacted_account_visitor( result ) );
|
||||||
|
|
@ -154,14 +72,6 @@ void operation_get_required_authorities( const operation& op, vector<authority>&
|
||||||
{
|
{
|
||||||
op.visit( required_auth_visitor( result ) );
|
op.visit( required_auth_visitor( result ) );
|
||||||
}
|
}
|
||||||
void operation_get_required_active_authorities( const operation& op, flat_set<account_id_type>& result )
|
|
||||||
{
|
|
||||||
op.visit( required_active_visitor( result ) );
|
|
||||||
}
|
|
||||||
void operation_get_required_owner_authorities( const operation& op, flat_set<account_id_type>& result )
|
|
||||||
{
|
|
||||||
op.visit( required_owner_visitor( result ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Used to validate operations in a polymorphic manner
|
* @brief Used to validate operations in a polymorphic manner
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue