Skip to content

Commit

Permalink
Hardfork fixes, proposals added to impacted visitor, refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusz-Trela committed Apr 25, 2019
1 parent 64471dd commit 40ea4ae
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 20 deletions.
2 changes: 1 addition & 1 deletion libraries/chain/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4752,10 +4752,10 @@ void database::init_hardforks()
FC_ASSERT( STEEM_HARDFORK_0_20 == 20, "Invalid hardfork configuration" );
_hardfork_times[ STEEM_HARDFORK_0_20 ] = fc::time_point_sec( STEEM_HARDFORK_0_20_TIME );
_hardfork_versions[ STEEM_HARDFORK_0_20 ] = STEEM_HARDFORK_0_20_VERSION;
#ifdef IS_TEST_NET
FC_ASSERT( STEEM_HARDFORK_0_21 == 21, "Invalid hardfork configuration" );
_hardfork_times[ STEEM_HARDFORK_0_21 ] = fc::time_point_sec( STEEM_HARDFORK_0_21_TIME );
_hardfork_versions[ STEEM_HARDFORK_0_21 ] = STEEM_HARDFORK_0_21_VERSION;
#ifdef IS_TEST_NET
FC_ASSERT( STEEM_HARDFORK_0_22 == 22, "Invalid hardfork configuration" );
_hardfork_times[ STEEM_HARDFORK_0_22 ] = fc::time_point_sec( STEEM_HARDFORK_0_22_TIME );
_hardfork_versions[ STEEM_HARDFORK_0_22 ] = STEEM_HARDFORK_0_22_VERSION;
Expand Down
16 changes: 16 additions & 0 deletions libraries/chain/util/impacted.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,22 @@ struct get_impacted_account_visitor
_impacted.insert(STEEM_TREASURY_ACCOUNT);
}

void operator()( const create_proposal_operation& op )
{
_impacted.insert( op.creator );
_impacted.insert( op.receiver );
}

void operator()( const update_proposal_votes_operation& op )
{
_impacted.insert( op.voter );
}

void operator()( const remove_proposal_operation& op )
{
_impacted.insert( op.proposal_owner );
}

void operator()( const hardfork_operation& op )
{
_impacted.insert( STEEM_INIT_MINER_NAME );
Expand Down
1 change: 0 additions & 1 deletion libraries/plugins/apis/sps_api/sps_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include <steem/plugins/sps_api/sps_api.hpp>
#include <steem/chain/sps_objects.hpp>
#include <appbase/application.hpp>
#include <steem/utilities/iterate_results.hpp>

namespace steem { namespace plugins { namespace sps {

Expand Down
2 changes: 1 addition & 1 deletion libraries/protocol/hardfork.d/0-preamble.hf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
#ifdef IS_TEST_NET
#define STEEM_NUM_HARDFORKS 22
#else
#define STEEM_NUM_HARDFORKS 20
#define STEEM_NUM_HARDFORKS 21
#endif
7 changes: 3 additions & 4 deletions libraries/protocol/include/steem/protocol/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

#else // IS LIVE STEEM NETWORK

#define STEEM_BLOCKCHAIN_VERSION ( version(0, 20, 6) )
#define STEEM_BLOCKCHAIN_VERSION ( version(0, 21, 0) )

#define STEEM_INIT_PUBLIC_KEY_STR "STM8GC13uCZbP44HzMLV6zPZGwVQ8Nt4Kji8PapsPiNq1BK153XTX"
#define STEEM_CHAIN_ID fc::sha256()
Expand Down Expand Up @@ -315,8 +315,8 @@
/// Represents the canonical account for specifying you will vote for directly (as opposed to a proxy)
#define STEEM_PROXY_TO_SELF_ACCOUNT ""
/// Represents the canonical root post parent account
#define STEEM_ROOT_POST_PARENT (account_name_type())/// Represents the canonical account with NO authority (nobody can access funds in null account)
/// Represents the account which holds resources needed when proposal is paid
#define STEEM_ROOT_POST_PARENT (account_name_type())
/// Represents the account with NO authority which holds resources for payouts according to given proposals
#define STEEM_TREASURY_ACCOUNT "steem.dao"
///@}

Expand All @@ -325,7 +325,6 @@
#define STEEM_TREASURY_FEE (10 * STEEM_BLOCKCHAIN_PRECISION)
#define STEEM_PROPOSAL_MAINTENANCE_PERIOD 3600
#define STEEM_PROPOSAL_MAINTENANCE_CLEANUP (60*60*24*1) /// 1 day
#define STEEM_PROPOSAL_MAINTENANCE_PERIOD_BLOCKS (STEEM_PROPOSAL_MAINTENANCE_PERIOD / STEEM_BLOCK_INTERVAL)
#define STEEM_PROPOSAL_SUBJECT_MAX_LENGTH 80
/// Max number of IDs passed at once to the update_proposal_voter_operation or remove_proposal_operation.
#define STEEM_PROPOSAL_MAX_IDS_NUMBER 5
Expand Down
23 changes: 12 additions & 11 deletions libraries/wallet/include/steem/wallet/wallet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <steem/plugins/sps_api/sps_api.hpp>

#include <steem/wallet/remote_node_api.hpp>

#include <steem/utilities/key_conversion.hpp>

#include <fc/macros.hpp>
Expand Down Expand Up @@ -1071,8 +1072,8 @@ class wallet_api

/**
* Create worker proposal
* @param _creator - account that create the proposal,
* @param _receiver - account that will be funded,
* @param _creator - the account that creates the proposal,
* @param _receiver - the account that will be funded,
* @param _start_date - start date of proposal,
* @param _end_date - end date of proposal,
* @param _daily_pay - the amount of SBD that is being requested to be paid out daily,
Expand All @@ -1089,7 +1090,7 @@ class wallet_api
bool broadcast );
/**
* Update existing worker proposal(s)
* @param _voter - voiting account,
* @param _voter - the account that votes,
* @param _proposals - array with proposal ids,
* @param _approve - set if proposal(s) should be approved or not.
*/
Expand All @@ -1102,9 +1103,9 @@ class wallet_api
* @param _start - starting value for querying results,
* @param _order_by - name a field for sorting operation,
* @param _order_type - set print order asc - ascdending, desc - descending,
* @param _limit - query limit
* @param _status - List only results with given status (expired, inactive, active, all, votable).
* @param _last_id - (optional) Start search from given id.
* @param _limit - query limit,
* @param _status - list only results with given status (expired, inactive, active, all, votable),
* @param _last_id - (optional) start search from given id.
*/
list_proposals_return list_proposals(fc::variant _start,
std::string _order_by = "creator",
Expand All @@ -1118,9 +1119,9 @@ class wallet_api
* @param _start - starting value for querying results,
* @param _order_by - name a field for sorting operation,
* @param _order_type - set print order asc - ascdending, desc - descending,
* @param _limit - query limit
* @param _status - List only results with given status (expired, inactive, active, all, votable).
* @param _last_id - (optional) Start search from given id.
* @param _limit - query limit,
* @param _status - list only results with given status (expired, inactive, active, all, votable),
* @param _last_id - (optional) start search from given id.
*/
list_voter_proposals_return list_voter_proposals(fc::variant _start,
std::string _order_by = "creator",
Expand All @@ -1137,8 +1138,8 @@ class wallet_api

/**
* Remove given proposal
* @param _deleter - authorized account
* @param _ids - proposal ids to be removed
* @param _deleter - authorized account,
* @param _ids - proposal ids to be removed.
*/
condenser_api::legacy_signed_transaction remove_proposal(account_name_type _deleter,
flat_set<int64_t> _ids, bool broadcast );
Expand Down
3 changes: 1 addition & 2 deletions programs/cli_wallet/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ int main( int argc, char** argv )
vector<string> allowed_ips;

bpo::variables_map options;

bpo::store( bpo::parse_command_line(argc, argv, opts), options );

if( options.count("help") )
Expand Down Expand Up @@ -259,8 +260,6 @@ int main( int argc, char** argv )
} );
}



if( !options.count( "daemon" ) )
{
wallet_cli->register_api( wapi );
Expand Down

0 comments on commit 40ea4ae

Please sign in to comment.