diff --git a/libraries/chain/include/steemit/chain/config.hpp b/libraries/chain/include/steemit/chain/config.hpp index 771561060f..2a56c0468a 100644 --- a/libraries/chain/include/steemit/chain/config.hpp +++ b/libraries/chain/include/steemit/chain/config.hpp @@ -3,7 +3,7 @@ */ #pragma once -#define STEEMIT_BLOCKCHAIN_VERSION ( version(0, 10, 0) ) +#define STEEMIT_BLOCKCHAIN_VERSION ( version(0, 10, 1) ) #define STEEMIT_BLOCKCHAIN_HARDFORK_VERSION ( hardfork_version( STEEMIT_BLOCKCHAIN_VERSION ) ) #ifdef IS_TEST_NET diff --git a/libraries/chain/steem_evaluator.cpp b/libraries/chain/steem_evaluator.cpp index 024f565f45..663116ed1c 100644 --- a/libraries/chain/steem_evaluator.cpp +++ b/libraries/chain/steem_evaluator.cpp @@ -149,6 +149,8 @@ void account_update_evaluator::do_apply( const account_update_operation& o ) * Because net_rshares is 0 there is no need to update any pending payout calculations or parent posts. */ void delete_comment_evaluator::do_apply( const delete_comment_operation& o ) { + FC_ASSERT( !db().is_producing() ); + if( db().has_hardfork( STEEMIT_HARDFORK_0_10 ) ) { const auto& auth = db().get_account( o.author ); @@ -205,6 +207,8 @@ void delete_comment_evaluator::do_apply( const delete_comment_operation& o ) { void comment_options_evaluator::do_apply( const comment_options_operation& o ) { + FC_ASSERT( !db().is_producing() ); + if( db().has_hardfork( STEEMIT_HARDFORK_0_10 ) ) { const auto& auth = db().get_account( o.author ); @@ -230,7 +234,10 @@ void comment_options_evaluator::do_apply( const comment_options_operation& o ) }); } void comment_evaluator::do_apply( const comment_operation& o ) -{ try { +{ + FC_ASSERT( !db().is_producing() ); + + try { if( db().is_producing() || db().has_hardfork( STEEMIT_HARDFORK_0_5__55 ) ) FC_ASSERT( o.title.size() + o.body.size() + o.json_metadata.size(), "something should change" ); @@ -773,7 +780,9 @@ void account_witness_vote_evaluator::do_apply( const account_witness_vote_operat } void vote_evaluator::do_apply( const vote_operation& o ) -{ try { +{ + FC_ASSERT( !db().is_producing() ); + try { const auto& comment = db().get_comment( o.author, o.permlink ); const auto& voter = db().get_account( o.voter ); @@ -1037,10 +1046,14 @@ void vote_evaluator::do_apply( const vote_operation& o ) } FC_CAPTURE_AND_RETHROW( (o)) } -void custom_evaluator::do_apply( const custom_operation& o ){} +void custom_evaluator::do_apply( const custom_operation& o ) +{ + FC_ASSERT( !db().is_producing() ); +} void custom_json_evaluator::do_apply( const custom_json_operation& o ) { + FC_ASSERT( !db().is_producing() ); FC_ASSERT( db().has_hardfork( STEEMIT_HARDFORK_0_5 ) ); if( db().has_hardfork( STEEMIT_HARDFORK_0_10 ) ) { diff --git a/libraries/wallet/include/steemit/wallet/wallet.hpp b/libraries/wallet/include/steemit/wallet/wallet.hpp index 3c7d951be4..2837191b19 100644 --- a/libraries/wallet/include/steemit/wallet/wallet.hpp +++ b/libraries/wallet/include/steemit/wallet/wallet.hpp @@ -707,6 +707,25 @@ class wallet_api */ annotated_signed_transaction vote( string voter, string author, string permlink, int16_t weight, bool broadcast ); + /** + * Challenge a user's authority. The challenger pays a fee to the challenged which is depositted as + * Steem Power. Until the challenged proves their active key, all posting rights are revoked. + * + * @param challenger The account issuing the challenge + * @param challenged The account being challenged + * @param broadcast true if you wish to broadcast the transaction + */ + annotated_signed_transaction challenge( string challenger, string challenged, bool broadcast ); + + /** + * Prove an account's active authority, fulfilling a challenge, restoring posting rights, and making + * the account immune to challenge for 24 hours. + * + * @param challenged The account that was challenged and is proving its authority. + * @param broadcast true if you wish to broadcast the transaction + */ + annotated_signed_transaction prove( string challenged, bool broadcast ); + /** * Account operations have sequence numbers from 0 to N where N is the most recent operation. This method * returns operations in the range [from-limit, from] @@ -809,6 +828,8 @@ FC_API( steemit::wallet::wallet_api, (cancel_order) (post_comment) (vote) + (challenge) + (prove) // private message api (send_private_message) diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index d8ccbaa347..c9ff4de5aa 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -1795,6 +1795,39 @@ annotated_signed_transaction wallet_api::vote( string voter, string author, stri return my->sign_transaction( tx, broadcast ); } + +annotated_signed_transaction wallet_api::challenge( string challenger, string challenged, bool broadcast ) +{ + FC_ASSERT( !is_locked() ); + + challenge_authority_operation op; + op.challenger = challenger; + op.challenged = challenged; + op.require_owner = false; + + signed_transaction tx; + tx.operations.push_back( op ); + tx.validate(); + + return my->sign_transaction( tx, broadcast ); +} + +annotated_signed_transaction wallet_api::prove( string challenged, bool broadcast ) +{ + FC_ASSERT( !is_locked() ); + + prove_authority_operation op; + op.challenged = challenged; + op.require_owner = false; + + signed_transaction tx; + tx.operations.push_back( op ); + tx.validate(); + + return my->sign_transaction( tx, broadcast ); +} + + annotated_signed_transaction wallet_api::get_transaction( transaction_id_type id )const { return my->_remote_db->get_transaction( id ); } diff --git a/tests/tests/operation_time_tests.cpp b/tests/tests/operation_time_tests.cpp index 3ef0a2e14a..b171f845c6 100644 --- a/tests/tests/operation_time_tests.cpp +++ b/tests/tests/operation_time_tests.cpp @@ -1602,7 +1602,7 @@ BOOST_AUTO_TEST_CASE( liquidity_rewards ) BOOST_TEST_MESSAGE( "Waiting 10 minutes" ); - generate_blocks( db.head_block_time() + STEEMIT_MIN_LIQUIDITY_REWARD_PERIOD_SEC_HF9, true ); + generate_blocks( db.head_block_time() + STEEMIT_MIN_LIQUIDITY_REWARD_PERIOD_SEC_HF10, true ); BOOST_TEST_MESSAGE( "Creating Limit Order for SBD that will be filled immediately." ); @@ -1669,7 +1669,7 @@ BOOST_AUTO_TEST_CASE( liquidity_rewards ) BOOST_TEST_MESSAGE( "Waiting 10 minutes" ); - generate_blocks( db.head_block_time() + STEEMIT_MIN_LIQUIDITY_REWARD_PERIOD_SEC_HF9, true ); + generate_blocks( db.head_block_time() + STEEMIT_MIN_LIQUIDITY_REWARD_PERIOD_SEC_HF10, true ); BOOST_TEST_MESSAGE( "Creating Limit Order for SBD that will stay on the books for 30 minutes." ); @@ -1687,7 +1687,7 @@ BOOST_AUTO_TEST_CASE( liquidity_rewards ) BOOST_TEST_MESSAGE( "Waiting 30 minutes" ); - generate_blocks( db.head_block_time() + STEEMIT_MIN_LIQUIDITY_REWARD_PERIOD_SEC_HF9, true ); + generate_blocks( db.head_block_time() + STEEMIT_MIN_LIQUIDITY_REWARD_PERIOD_SEC_HF10, true ); BOOST_TEST_MESSAGE( "Filling both limit orders." ); @@ -1761,7 +1761,7 @@ BOOST_AUTO_TEST_CASE( liquidity_rewards ) tx.sign( alice_private_key, db.get_chain_id() ); db.push_transaction( tx, 0 ); - generate_blocks( db.head_block_time() + fc::seconds( STEEMIT_MIN_LIQUIDITY_REWARD_PERIOD_SEC_HF9.to_seconds() / 2 ), true ); + generate_blocks( db.head_block_time() + fc::seconds( STEEMIT_MIN_LIQUIDITY_REWARD_PERIOD_SEC_HF10.to_seconds() / 2 ), true ); op.owner = "bob"; op.orderid = 7; @@ -1775,7 +1775,7 @@ BOOST_AUTO_TEST_CASE( liquidity_rewards ) tx.sign( bob_private_key, db.get_chain_id() ); db.push_transaction( tx, 0 ); - generate_blocks( db.head_block_time() + fc::seconds( STEEMIT_MIN_LIQUIDITY_REWARD_PERIOD_SEC_HF9.to_seconds() / 2 ), true ); + generate_blocks( db.head_block_time() + fc::seconds( STEEMIT_MIN_LIQUIDITY_REWARD_PERIOD_SEC_HF10.to_seconds() / 2 ), true ); ops = get_last_operations( 1 ); fill_order_op = ops[0].get< fill_order_operation >(); @@ -1808,7 +1808,7 @@ BOOST_AUTO_TEST_CASE( liquidity_rewards ) BOOST_CHECK_EQUAL( reward->steem_volume, sam_steem_volume ); BOOST_CHECK( reward->last_update == sam_reward_last_update ); - generate_blocks( db.head_block_time() + STEEMIT_MIN_LIQUIDITY_REWARD_PERIOD_SEC_HF9, true ); + generate_blocks( db.head_block_time() + STEEMIT_MIN_LIQUIDITY_REWARD_PERIOD_SEC_HF10, true ); op.owner = "sam"; op.orderid = 8; @@ -1880,7 +1880,7 @@ BOOST_AUTO_TEST_CASE( liquidity_rewards ) tx.sign( alice_private_key, db.get_chain_id() ); db.push_transaction( tx, 0 ); - generate_blocks( db.head_block_time() + STEEMIT_MIN_LIQUIDITY_REWARD_PERIOD_SEC_HF9, true ); + generate_blocks( db.head_block_time() + STEEMIT_MIN_LIQUIDITY_REWARD_PERIOD_SEC_HF10, true ); op.owner = "dave"; op.amount_to_sell = asset( 7 * ( alice_sbd.amount.value / 20 ), SBD_SYMBOL );; @@ -2009,7 +2009,7 @@ BOOST_AUTO_TEST_CASE( liquidity_rewards ) tx.sign( bob_private_key, db.get_chain_id() ); db.push_transaction( tx, 0 ); - generate_blocks( db.head_block_time() + STEEMIT_MIN_LIQUIDITY_REWARD_PERIOD_SEC_HF9, true ); + generate_blocks( db.head_block_time() + STEEMIT_MIN_LIQUIDITY_REWARD_PERIOD_SEC_HF10, true ); op.owner = "dave"; op.orderid = 13;