55namespace golos { namespace chain {
66
77 void witness_update_evaluator::do_apply (const witness_update_operation& o) {
8- db () .get_account (o.owner ); // verify owner exists
8+ _db .get_account (o.owner ); // verify owner exists
99
10- if (db () .has_hardfork (STEEMIT_HARDFORK_0_1 )) {
10+ if (_db .has_hardfork (STEEMIT_HARDFORK_0_1 )) {
1111 FC_ASSERT (o.url .size () <= STEEMIT_MAX_WITNESS_URL_LENGTH , " URL is too long" );
1212 } else if (o.url .size () > STEEMIT_MAX_WITNESS_URL_LENGTH ) {
1313 // after HF, above check can be moved to validate() if reindex doesn't show this warning
14- wlog (" URL is too long in block ${b}" , (" b" , db () .head_block_num () + 1 ));
14+ wlog (" URL is too long in block ${b}" , (" b" , _db .head_block_num () + 1 ));
1515 }
1616
17- if (db () .has_hardfork (STEEMIT_HARDFORK_0_14__410 )) {
17+ if (_db .has_hardfork (STEEMIT_HARDFORK_0_14__410 )) {
1818 FC_ASSERT (o.props .account_creation_fee .symbol == STEEM_SYMBOL );
1919 } else if (o.props .account_creation_fee .symbol != STEEM_SYMBOL ) {
2020 // after HF, above check can be moved to validate() if reindex doesn't show this warning
21- wlog (" Wrong fee symbol in block ${b}" , (" b" ,
22- db ().head_block_num () + 1 ));
21+ wlog (" Wrong fee symbol in block ${b}" , (" b" , _db.head_block_num () + 1 ));
2322 }
2423
25- const auto &idx = db ().get_index <witness_index>().indices ().get <by_name>();
24+ const bool has_hf18 = _db.has_hardfork (STEEMIT_HARDFORK_0_18__673 );
25+
26+ // TODO: remove this after HF 18
27+ if (has_hf18) {
28+ if (o.props .account_creation_fee .amount .value != STEEMIT_MIN_ACCOUNT_CREATION_FEE ) {
29+ wlog (" The chain_properties_update_operation should be used to update account_creation_fee" );
30+ }
31+ if (o.props .sbd_interest_rate != STEEMIT_DEFAULT_SBD_INTEREST_RATE ) {
32+ wlog (" The chain_properties_update_operation should be used to update sbd_interest_rate" );
33+ }
34+ if (o.props .maximum_block_size != STEEMIT_MIN_BLOCK_SIZE_LIMIT * 2 ) {
35+ wlog (" The chain_properties_update_operation should be used to update maximum_block_size" );
36+ }
37+ }
38+
39+ const auto &idx = _db.get_index <witness_index>().indices ().get <by_name>();
2640 auto itr = idx.find (o.owner );
2741 if (itr != idx.end ()) {
28- db () .modify (*itr, [&](witness_object& w) {
42+ _db .modify (*itr, [&](witness_object& w) {
2943 from_string (w.url , o.url );
3044 w.signing_key = o.block_signing_key ;
31- w.props = o.props ;
45+ if (!has_hf18) {
46+ w.props = o.props ;
47+ }
3248 });
3349 } else {
34- db () .create <witness_object>([&](witness_object& w) {
50+ _db .create <witness_object>([&](witness_object& w) {
3551 w.owner = o.owner ;
3652 from_string (w.url , o.url );
3753 w.signing_key = o.block_signing_key ;
38- w.created = db ().head_block_time ();
39- w.props = o.props ;
54+ w.created = _db.head_block_time ();
55+ if (!has_hf18) {
56+ w.props = o.props ;
57+ }
4058 });
4159 }
4260 }
@@ -54,20 +72,21 @@ namespace golos { namespace chain {
5472
5573 void chain_properties_update_evaluator::do_apply (const chain_properties_update_operation& o) {
5674 ASSERT_REQ_HF (STEEMIT_HARDFORK_0_18__673 , " Chain properties" ); // remove after hf
57- db () .get_account (o.owner ); // verify owner exists
75+ _db .get_account (o.owner ); // verify owner exists
5876
59- const auto &idx = db () .get_index <witness_index>().indices ().get <by_name>();
77+ const auto &idx = _db .get_index <witness_index>().indices ().get <by_name>();
6078 auto itr = idx.find (o.owner );
6179 if (itr != idx.end ()) {
62- db () .modify (*itr, [&](witness_object& w) {
80+ _db .modify (*itr, [&](witness_object& w) {
6381 w.props = o.props .visit (chain_properties_convert ());
6482 });
6583 } else {
66- db () .create <witness_object>([&](witness_object& w) {
84+ _db .create <witness_object>([&](witness_object& w) {
6785 w.owner = o.owner ;
68- w.created = db () .head_block_time ();
86+ w.created = _db .head_block_time ();
6987 w.props = o.props .visit (chain_properties_convert ());
7088 });
7189 }
7290 }
91+
7392} } // golos::chain
0 commit comments