error message corrections at other places

This commit is contained in:
Sandip Patel 2019-10-19 16:38:12 +05:30
parent c025f639d7
commit 0800e2bc67
3 changed files with 21 additions and 5 deletions

View file

@ -28,6 +28,16 @@ namespace graphene { namespace chain {
enum class vesting_balance_type { normal, gpos };
inline std::string get_vesting_balance_type(vesting_balance_type type) {
switch (type) {
case vesting_balance_type::normal:
return "NORMAL";
case vesting_balance_type::gpos:
default:
return "GPOS";
}
}
struct linear_vesting_policy_initializer
{
/** while vesting begins on begin_timestamp, none may be claimed before vesting_cliff_seconds have passed */

View file

@ -145,7 +145,8 @@ void_result vesting_balance_withdraw_evaluator::do_evaluate( const vesting_balan
const vesting_balance_object& vbo = op.vesting_balance( d );
FC_ASSERT( op.owner == vbo.owner, "", ("op.owner", op.owner)("vbo.owner", vbo.owner) );
FC_ASSERT( vbo.is_withdraw_allowed( now, op.amount ), "GPOS Vested Balance cannont be withdrwan during the locking period", ("now", now)("op", op)("vbo", vbo) );
FC_ASSERT( vbo.is_withdraw_allowed( now, op.amount ), "${balance_type} Vested Balance cannont be withdrwan during the locking period",
("balance_type", get_vesting_balance_type(vbo.balance_type))("now", now)("op", op)("vbo", vbo) );
assert( op.amount <= vbo.balance ); // is_withdraw_allowed should fail before this check is reached
/* const account_object& owner_account = op.owner( d ); */

View file

@ -2005,9 +2005,14 @@ public:
fc::optional<vesting_balance_id_type> vbid = maybe_id<vesting_balance_id_type>(witness_name);
if( !vbid )
{
witness_object wit = get_witness( witness_name );
FC_ASSERT( wit.pay_vb );
vbid = wit.pay_vb;
if (is_witness(witness_name))
{
witness_object wit = get_witness( witness_name );
FC_ASSERT( wit.pay_vb, "Account ${account} has no core TOKEN vested and thus its not allowed to withdraw.", ("account", witness_name));
vbid = wit.pay_vb;
}
else
FC_THROW("Account ${account} has no core TOKEN vested and thus its not allowed to withdraw.", ("account", witness_name));
}
vesting_balance_object vbo = get_object< vesting_balance_object >( *vbid );
@ -2052,7 +2057,7 @@ public:
if (is_witness(account_name))
{
witness_object wit = get_witness( account_name );
FC_ASSERT( wit.pay_vb );
FC_ASSERT( wit.pay_vb, "Account ${account} has no core TOKEN vested and thus its not allowed to withdraw.", ("account", account_name));
vbid = wit.pay_vb;
}
else