Skip to content

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Vandeberg committed Jul 16, 2016
2 parents 7a2990e + 1ff25a6 commit 7a9962c
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 12 deletions.
2 changes: 1 addition & 1 deletion libraries/chain/include/steemit/chain/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 16 additions & 3 deletions libraries/chain/steem_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 );
Expand All @@ -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" );

Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 ) )
{
Expand Down
21 changes: 21 additions & 0 deletions libraries/wallet/include/steemit/wallet/wallet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -809,6 +828,8 @@ FC_API( steemit::wallet::wallet_api,
(cancel_order)
(post_comment)
(vote)
(challenge)
(prove)

// private message api
(send_private_message)
Expand Down
33 changes: 33 additions & 0 deletions libraries/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down
16 changes: 8 additions & 8 deletions tests/tests/operation_time_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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." );

Expand Down Expand Up @@ -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." );

Expand All @@ -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." );

Expand Down Expand Up @@ -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;
Expand All @@ -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 >();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 );;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7a9962c

Please sign in to comment.