From 58e4b741c42126ba69ce59d56b765f74762b4bc7 Mon Sep 17 00:00:00 2001 From: gladcow Date: Fri, 20 Dec 2019 00:46:43 +0300 Subject: [PATCH] make new fields optional --- .../graphene/chain/protocol/vesting.hpp | 22 +++++++++---------- libraries/chain/vesting_balance_evaluator.cpp | 3 ++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/libraries/chain/include/graphene/chain/protocol/vesting.hpp b/libraries/chain/include/graphene/chain/protocol/vesting.hpp index 7c53b378..d4d83f41 100644 --- a/libraries/chain/include/graphene/chain/protocol/vesting.hpp +++ b/libraries/chain/include/graphene/chain/protocol/vesting.hpp @@ -80,12 +80,12 @@ namespace graphene { namespace chain { { struct fee_parameters_type { uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION; }; - asset fee; - account_id_type creator; ///< Who provides funds initially - account_id_type owner; ///< Who is able to withdraw the balance - asset amount; - vesting_policy_initializer policy; - vesting_balance_type balance_type; + asset fee; + account_id_type creator; ///< Who provides funds initially + account_id_type owner; ///< Who is able to withdraw the balance + asset amount; + vesting_policy_initializer policy; + optional balance_type; account_id_type fee_payer()const { return creator; } void validate()const @@ -108,11 +108,11 @@ namespace graphene { namespace chain { { struct fee_parameters_type { uint64_t fee = 20*GRAPHENE_BLOCKCHAIN_PRECISION; }; - asset fee; - vesting_balance_id_type vesting_balance; - account_id_type owner; ///< Must be vesting_balance.owner - asset amount; - vesting_balance_type balance_type; + asset fee; + vesting_balance_id_type vesting_balance; + account_id_type owner; ///< Must be vesting_balance.owner + asset amount; + optional balance_type; account_id_type fee_payer()const { return owner; } void validate()const diff --git a/libraries/chain/vesting_balance_evaluator.cpp b/libraries/chain/vesting_balance_evaluator.cpp index 94e22dca..bd64a626 100644 --- a/libraries/chain/vesting_balance_evaluator.cpp +++ b/libraries/chain/vesting_balance_evaluator.cpp @@ -108,7 +108,8 @@ object_id_type vesting_balance_create_evaluator::do_apply( const vesting_balance else { op.policy.visit(init_policy_visitor(obj.policy, op.amount.amount, now)); } - obj.balance_type = op.balance_type; + if(op.balance_type) + obj.balance_type = *op.balance_type; } );