diff --git a/libraries/chain/include/graphene/chain/protocol/vesting.hpp b/libraries/chain/include/graphene/chain/protocol/vesting.hpp index ac995aaf..2a861b2a 100644 --- a/libraries/chain/include/graphene/chain/protocol/vesting.hpp +++ b/libraries/chain/include/graphene/chain/protocol/vesting.hpp @@ -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 */ diff --git a/libraries/chain/vesting_balance_evaluator.cpp b/libraries/chain/vesting_balance_evaluator.cpp index 9630d011..9f42d4ff 100644 --- a/libraries/chain/vesting_balance_evaluator.cpp +++ b/libraries/chain/vesting_balance_evaluator.cpp @@ -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 ); */ diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 75c47d8a..c7e605cc 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -2005,9 +2005,14 @@ public: fc::optional vbid = maybe_id(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