From 28c57a6739e93c54ed59ff3afc9b5178f91ebd60 Mon Sep 17 00:00:00 2001 From: Seungwon Eugene Jeong Date: Wed, 23 Jan 2019 14:58:10 +0900 Subject: [PATCH 1/2] fix 14 week powerdown Fix #3237 - Floor -> Ceil - Combine the zero new_vesting_withdraw_rate case. --- libraries/chain/steem_evaluator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/chain/steem_evaluator.cpp b/libraries/chain/steem_evaluator.cpp index 1890c4be28..be6a84bea8 100644 --- a/libraries/chain/steem_evaluator.cpp +++ b/libraries/chain/steem_evaluator.cpp @@ -1156,8 +1156,8 @@ void withdraw_vesting_evaluator::do_apply( const withdraw_vesting_operation& o ) { auto new_vesting_withdraw_rate = asset( o.vesting_shares.amount / vesting_withdraw_intervals, VESTS_SYMBOL ); - if( new_vesting_withdraw_rate.amount == 0 ) - new_vesting_withdraw_rate.amount = 1; + if( new_vesting_withdraw_rate.amount * vesting_withdraw_intervals < o.vesting_shares.amount ) + new_vesting_withdraw_rate.amount += 1; if( _db.has_hardfork( STEEM_HARDFORK_0_5__57 ) ) FC_ASSERT( account.vesting_withdraw_rate != new_vesting_withdraw_rate, "This operation would not change the vesting withdraw rate." ); From 4aaa073bc137b55c418b70a91a40ef04dc75f9fd Mon Sep 17 00:00:00 2001 From: Seungwon Eugene Jeong Date: Fri, 8 Mar 2019 22:09:03 +0000 Subject: [PATCH 2/2] fix 14 week powerdown add hardfork check --- libraries/chain/steem_evaluator.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libraries/chain/steem_evaluator.cpp b/libraries/chain/steem_evaluator.cpp index be6a84bea8..154cf68a15 100644 --- a/libraries/chain/steem_evaluator.cpp +++ b/libraries/chain/steem_evaluator.cpp @@ -1156,8 +1156,16 @@ void withdraw_vesting_evaluator::do_apply( const withdraw_vesting_operation& o ) { auto new_vesting_withdraw_rate = asset( o.vesting_shares.amount / vesting_withdraw_intervals, VESTS_SYMBOL ); - if( new_vesting_withdraw_rate.amount * vesting_withdraw_intervals < o.vesting_shares.amount ) - new_vesting_withdraw_rate.amount += 1; + if( db.has_hardfork( STEEM_HARDFORK_0_21 ) ) + { + if( new_vesting_withdraw_rate.amount * vesting_withdraw_intervals < o.vesting_shares.amount ) + new_vesting_withdraw_rate.amount += 1; + } + else + { + if( new_vesting_withdraw_rate.amount == 0 ) + new_vesting_withdraw_rate.amount = 1; + } if( _db.has_hardfork( STEEM_HARDFORK_0_5__57 ) ) FC_ASSERT( account.vesting_withdraw_rate != new_vesting_withdraw_rate, "This operation would not change the vesting withdraw rate." );