SON-297_SON-336 - SON vesting functionality broken after graphene merge (#331)

Co-authored-by: satyakoneru <15652887+satyakoneru@users.noreply.github.com>
This commit is contained in:
sierra19XX 2020-04-02 21:22:05 +11:00 committed by GitHub
parent 8aaa3791bf
commit 5bf245ee6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View file

@ -139,7 +139,7 @@ void_result vesting_balance_withdraw_evaluator::do_evaluate( const vesting_balan
const time_point_sec now = d.head_block_time();
const vesting_balance_object& vbo = op.vesting_balance( d );
if(vbo.balance_type == vesting_balance_type::normal)
if(vbo.balance_type == vesting_balance_type::normal || vbo.balance_type == vesting_balance_type::son)
{
FC_ASSERT( op.owner == vbo.owner, "", ("op.owner", op.owner)("vbo.owner", vbo.owner) );
FC_ASSERT( vbo.is_withdraw_allowed( now, op.amount ), "Account has insufficient ${balance_type} Vested Balance to withdraw",
@ -179,7 +179,7 @@ void_result vesting_balance_withdraw_evaluator::do_apply( const vesting_balance_
//Handling all GPOS withdrawls separately from normal and SONs(future extension).
// One request/transaction would be sufficient to withdraw from multiple vesting balance ids
const vesting_balance_object& vbo = op.vesting_balance( d );
if(vbo.balance_type == vesting_balance_type::normal)
if(vbo.balance_type == vesting_balance_type::normal || vbo.balance_type == vesting_balance_type::son)
{
// Allow zero balance objects to stick around, (1) to comply
// with the chain's "objects live forever" design principle, (2)

View file

@ -2414,8 +2414,8 @@ public:
vesting_balance_object vbo = get_object< vesting_balance_object >( *vbid );
if(vbo.balance_type != vesting_balance_type::normal)
FC_THROW("Allowed to withdraw only Normal type vest balances with this method");
if(vbo.balance_type == vesting_balance_type::gpos)
FC_THROW("Allowed to withdraw only Normal and Son type vest balances with this method");
vesting_balance_withdraw_operation vesting_balance_withdraw_op;
@ -6729,7 +6729,8 @@ vesting_balance_object_with_info::vesting_balance_object_with_info( const vestin
: vesting_balance_object( vbo )
{
allowed_withdraw = get_allowed_withdraw( now );
if(vbo.balance_type == vesting_balance_type::gpos)
if(vbo.balance_type == vesting_balance_type::gpos ||
((vbo.balance_type == vesting_balance_type::son) && (vbo.policy.which() == vesting_policy::tag<linear_vesting_policy>::value)))
allowed_withdraw_time = vbo.policy.get<linear_vesting_policy>().begin_timestamp + vbo.policy.get<linear_vesting_policy>().vesting_cliff_seconds;
else
allowed_withdraw_time = now;