Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • hive/hive
1 result
Select Git revision
Show changes
Showing
with 968 additions and 540 deletions
#ifndef HIVE_HARDFORK_1_25
#define HIVE_HARDFORK_1_25 25
#define HIVE_SMT_HARDFORK HIVE_HARDFORK_1_25
#define HIVE_HARDFORK_1_25_TIME 1640952000 // Thursday, 31 December 2021 12:00:00 GMT
long next_hf_time();
#define HIVE_HARDFORK_1_25_TIME next_hf_time()
#define HIVE_HARDFORK_1_25_VERSION hardfork_version( 1, 25 )
#define HIVE_HARDFORK_1_25_MAX_OLD_GOVERNANCE_VOTE_EXPIRE_SHIFT (fc::days(182))
#define HARDFORK_1_25_FIRST_GOVERNANCE_VOTE_EXPIRE_TIMESTAMP (fc::time_point_sec(HIVE_HARDFORK_1_25_TIME) + HIVE_GOVERNANCE_VOTE_EXPIRATION_PERIOD)
#endif
#ifndef HIVE_HARDFORK_1_26
#define HIVE_HARDFORK_1_26 26
#define HIVE_SMT_HARDFORK HIVE_HARDFORK_1_26
#define HIVE_HARDFORK_1_26_TIME 1640952000 // Thursday, 31 December 2021 12:00:00 GMT
#define HIVE_HARDFORK_1_26_VERSION hardfork_version( 1, 26 )
#endif
......@@ -264,7 +264,7 @@ namespace hive { namespace protocol {
itr = props.find( "maximum_block_size" );
if( itr != props.end() )
{
uint32_t maximum_block_size;
uint32_t maximum_block_size = 0u;
fc::raw::unpack_from_vector( itr->second, maximum_block_size );
FC_ASSERT( maximum_block_size >= HIVE_MIN_BLOCK_SIZE_LIMIT, "maximum_block_size smaller than minimum max block size" );
}
......@@ -275,7 +275,7 @@ namespace hive { namespace protocol {
if( itr != props.end() )
{
uint16_t hbd_interest_rate;
uint16_t hbd_interest_rate = 0u;
fc::raw::unpack_from_vector( itr->second, hbd_interest_rate );
FC_ASSERT( hbd_interest_rate >= 0, "hbd_interest_rate must be positive" );
FC_ASSERT( hbd_interest_rate <= HIVE_100_PERCENT, "hbd_interest_rate must not exceed 100%" );
......@@ -316,7 +316,7 @@ namespace hive { namespace protocol {
itr = props.find( "account_subsidy_budget" );
if( itr != props.end() )
{
int32_t account_subsidy_budget;
int32_t account_subsidy_budget = 0u;
fc::raw::unpack_from_vector( itr->second, account_subsidy_budget ); // Checks that the value can be deserialized
FC_ASSERT( account_subsidy_budget >= HIVE_RD_MIN_BUDGET, "Budget must be at least ${n}", ("n", HIVE_RD_MIN_BUDGET) );
FC_ASSERT( account_subsidy_budget <= HIVE_RD_MAX_BUDGET, "Budget must be at most ${n}", ("n", HIVE_RD_MAX_BUDGET) );
......@@ -325,7 +325,7 @@ namespace hive { namespace protocol {
itr = props.find( "account_subsidy_decay" );
if( itr != props.end() )
{
uint32_t account_subsidy_decay;
uint32_t account_subsidy_decay = 0u;
fc::raw::unpack_from_vector( itr->second, account_subsidy_decay ); // Checks that the value can be deserialized
FC_ASSERT( account_subsidy_decay >= HIVE_RD_MIN_DECAY, "Decay must be at least ${n}", ("n", HIVE_RD_MIN_DECAY) );
FC_ASSERT( account_subsidy_decay <= HIVE_RD_MAX_DECAY, "Decay must be at most ${n}", ("n", HIVE_RD_MAX_DECAY) );
......@@ -341,7 +341,7 @@ namespace hive { namespace protocol {
void account_witness_proxy_operation::validate() const
{
validate_account_name( account );
if( proxy.size() )
if( !is_clearing_proxy() )
validate_account_name( proxy );
FC_ASSERT( proxy != account, "Cannot proxy to self" );
}
......
......@@ -9,7 +9,7 @@
// This is checked by get_config_check.sh called from Dockerfile
#ifdef IS_TEST_NET
#define HIVE_BLOCKCHAIN_VERSION ( version(1, 25, 0) )
#define HIVE_BLOCKCHAIN_VERSION ( version(1, 26, 0) )
#define HIVE_INIT_PRIVATE_KEY (fc::ecc::private_key::regenerate(fc::sha256::hash(std::string("init_key"))))
#define HIVE_INIT_PUBLIC_KEY_STR (std::string( hive::protocol::public_key_type(HIVE_INIT_PRIVATE_KEY.get_public_key()) ))
......@@ -45,11 +45,14 @@
#define HIVE_PROPOSAL_MAINTENANCE_PERIOD 3600
#define HIVE_PROPOSAL_MAINTENANCE_CLEANUP (60*60*24*1) // 1 day
#define HIVE_DAILY_PROPOSAL_MAINTENANCE_PERIOD (60*60) /// 1 hour
#define HIVE_DAILY_PROPOSAL_MAINTENANCE_PERIOD (60*60) /// 1 hour
#define HIVE_GOVERNANCE_VOTE_EXPIRATION_PERIOD (fc::days(20))
#define HIVE_GLOBAL_REMOVE_THRESHOLD 20
#else // IS LIVE HIVE NETWORK
#define HIVE_BLOCKCHAIN_VERSION ( version(1, 24, 8) )
#define HIVE_BLOCKCHAIN_VERSION ( version(1, 25, 8) )
#define HIVE_INIT_PUBLIC_KEY_STR "STM8GC13uCZbP44HzMLV6zPZGwVQ8Nt4Kji8PapsPiNq1BK153XTX"
#define STEEM_CHAIN_ID fc::sha256()
......@@ -80,7 +83,10 @@
#define HIVE_PROPOSAL_MAINTENANCE_PERIOD 3600
#define HIVE_PROPOSAL_MAINTENANCE_CLEANUP (60*60*24*1) /// 1 day
#define HIVE_DAILY_PROPOSAL_MAINTENANCE_PERIOD HIVE_ONE_DAY_SECONDS
#define HIVE_DAILY_PROPOSAL_MAINTENANCE_PERIOD HIVE_ONE_DAY_SECONDS
#define HIVE_GOVERNANCE_VOTE_EXPIRATION_PERIOD (fc::days(365))
#define HIVE_GLOBAL_REMOVE_THRESHOLD 200
#endif
......
......@@ -561,10 +561,12 @@ namespace hive { namespace protocol {
struct account_witness_proxy_operation : public base_operation
{
account_name_type account;
account_name_type proxy;
account_name_type proxy = HIVE_PROXY_TO_SELF_ACCOUNT;
void validate()const;
void get_required_active_authorities( flat_set<account_name_type>& a )const{ a.insert(account); }
bool is_clearing_proxy() const { return proxy == HIVE_PROXY_TO_SELF_ACCOUNT; }
};
......
......@@ -8,9 +8,9 @@
namespace hive { namespace protocol {
struct author_reward_operation : public virtual_operation {
author_reward_operation(){}
author_reward_operation( const account_name_type& a, const string& p, const asset& s, const asset& st, const asset& v, const asset& c )
:author(a), permlink(p), hbd_payout(s), hive_payout(st), vesting_payout(v), curators_vesting_payout(c) {}
author_reward_operation() = default;
author_reward_operation( const account_name_type& a, const string& p, const asset& s, const asset& st, const asset& v, const asset& c, bool must_be_claimed)
:author(a), permlink(p), hbd_payout(s), hive_payout(st), vesting_payout(v), curators_vesting_payout(c), payout_must_be_claimed(must_be_claimed) {}
account_name_type author;
string permlink;
......@@ -18,19 +18,25 @@ namespace hive { namespace protocol {
asset hive_payout;
asset vesting_payout;
asset curators_vesting_payout;
/// If set to true, payout has been stored in the separate reward balance, and must be claimed
/// to be transferred to regular balance.
bool payout_must_be_claimed = false;
};
struct curation_reward_operation : public virtual_operation
{
curation_reward_operation(){}
curation_reward_operation( const string& c, const asset& r, const string& a, const string& p )
:curator(c), reward(r), comment_author(a), comment_permlink(p) {}
curation_reward_operation() = default;
curation_reward_operation( const string& c, const asset& r, const string& a, const string& p, bool must_be_claimed)
:curator(c), reward(r), comment_author(a), comment_permlink(p), payout_must_be_claimed(must_be_claimed) {}
account_name_type curator;
asset reward;
account_name_type comment_author;
string comment_permlink;
/// If set to true, payout has been stored in the separate reward balance, and must be claimed
/// to be transferred to regular balance.
bool payout_must_be_claimed = false;
};
......@@ -98,6 +104,52 @@ namespace hive { namespace protocol {
};
struct transfer_to_vesting_completed_operation : public virtual_operation
{
transfer_to_vesting_completed_operation(){}
transfer_to_vesting_completed_operation( const string& f, const string& t, const asset& s, const asset& v )
:from_account(f), to_account(t), hive_vested(s), vesting_shares_received(v) {}
account_name_type from_account;
account_name_type to_account;
asset hive_vested;
asset vesting_shares_received;
};
struct pow_reward_operation : public virtual_operation
{
pow_reward_operation(){}
pow_reward_operation( const string& w, const asset& r )
:worker(w), reward(r) {}
account_name_type worker;
asset reward;
};
struct vesting_shares_split_operation : public virtual_operation
{
vesting_shares_split_operation(){}
vesting_shares_split_operation( const string& o, const asset& old_vests, const asset& new_vests )
:owner(o), vesting_shares_before_split(old_vests), vesting_shares_after_split(new_vests) {}
account_name_type owner;
asset vesting_shares_before_split;
asset vesting_shares_after_split;
};
struct account_created_operation : public virtual_operation
{
account_created_operation(){}
account_created_operation( const string& new_account_name, const string& creator, const asset& initial_vesting_shares, const asset& initial_delegation )
:new_account_name(new_account_name), creator(creator), initial_vesting_shares(initial_vesting_shares), initial_delegation(initial_delegation) {}
account_name_type new_account_name;
account_name_type creator;
asset initial_vesting_shares;
asset initial_delegation; // if created with account_create_with_delegation
};
struct shutdown_witness_operation : public virtual_operation
{
shutdown_witness_operation(){}
......@@ -278,15 +330,28 @@ namespace hive { namespace protocol {
asset hive_transferred;
};
struct expired_account_notification_operation : public virtual_operation
{
expired_account_notification_operation() = default;
expired_account_notification_operation(const account_name_type& acc)
: account(acc) {}
account_name_type account;
};
} } //hive::protocol
FC_REFLECT( hive::protocol::author_reward_operation, (author)(permlink)(hbd_payout)(hive_payout)(vesting_payout)(curators_vesting_payout) )
FC_REFLECT( hive::protocol::curation_reward_operation, (curator)(reward)(comment_author)(comment_permlink) )
FC_REFLECT( hive::protocol::author_reward_operation, (author)(permlink)(hbd_payout)(hive_payout)(vesting_payout)(curators_vesting_payout)(payout_must_be_claimed) )
FC_REFLECT( hive::protocol::curation_reward_operation, (curator)(reward)(comment_author)(comment_permlink)(payout_must_be_claimed) )
FC_REFLECT( hive::protocol::comment_reward_operation, (author)(permlink)(payout)(author_rewards)(total_payout_value)(curator_payout_value)(beneficiary_payout_value) )
FC_REFLECT( hive::protocol::fill_convert_request_operation, (owner)(requestid)(amount_in)(amount_out) )
FC_REFLECT( hive::protocol::account_created_operation, (new_account_name)(creator)(initial_vesting_shares)(initial_delegation) )
FC_REFLECT( hive::protocol::liquidity_reward_operation, (owner)(payout) )
FC_REFLECT( hive::protocol::interest_operation, (owner)(interest) )
FC_REFLECT( hive::protocol::fill_vesting_withdraw_operation, (from_account)(to_account)(withdrawn)(deposited) )
FC_REFLECT( hive::protocol::transfer_to_vesting_completed_operation, (from_account)(to_account)(hive_vested)(vesting_shares_received) )
FC_REFLECT( hive::protocol::pow_reward_operation, (worker)(reward) )
FC_REFLECT( hive::protocol::vesting_shares_split_operation, (owner)(vesting_shares_before_split)(vesting_shares_after_split) )
FC_REFLECT( hive::protocol::shutdown_witness_operation, (owner) )
FC_REFLECT( hive::protocol::fill_order_operation, (current_owner)(current_orderid)(current_pays)(open_owner)(open_orderid)(open_pays) )
FC_REFLECT( hive::protocol::fill_transfer_from_savings_operation, (from)(to)(amount)(request_id)(memo) )
......@@ -304,3 +369,5 @@ FC_REFLECT( hive::protocol::sps_fund_operation, (fund_account)(additional_funds)
FC_REFLECT( hive::protocol::sps_convert_operation, (fund_account)(hive_amount_in)(hbd_amount_out) )
FC_REFLECT( hive::protocol::hardfork_hive_operation, (account)(treasury)(hbd_transferred)(hive_transferred)(vests_converted)(total_hive_from_vests) )
FC_REFLECT( hive::protocol::hardfork_hive_restore_operation, (account)(treasury)(hbd_transferred)(hive_transferred) )
FC_REFLECT( hive::protocol::expired_account_notification_operation, (account) )
......@@ -109,7 +109,12 @@ namespace hive { namespace protocol {
consolidate_treasury_balance_operation,
effective_comment_vote_operation,
ineffective_delete_comment_operation,
sps_convert_operation
sps_convert_operation,
expired_account_notification_operation,
transfer_to_vesting_completed_operation,
pow_reward_operation,
vesting_shares_split_operation,
account_created_operation
> operation;
/*void operation_get_required_authorities( const operation& op,
......
......@@ -13,7 +13,7 @@ struct sign_state
* produce a signature for this key, else returns false.
*/
bool signed_by( const public_key_type& k );
bool check_authority( string id );
bool check_authority( const string& id );
/**
* Checks to see if we have signatures of the active authorites of
......
......@@ -16,7 +16,7 @@ bool sign_state::signed_by( const public_key_type& k )
return itr->second = true;
}
bool sign_state::check_authority( string id )
bool sign_state::check_authority( const string& id )
{
if( approved_by.find(id) != approved_by.end() ) return true;
uint32_t account_auth_count = 1;
......
......@@ -8,7 +8,7 @@
namespace hive { namespace protocol {
/* Quick conversion utilities from http://joelverhagen.com/blog/2010/11/convert-an-int-to-a-string-and-vice-versa-in-c/ */
inline int string_to_int( fc::string input )
inline int string_to_int( const fc::string& input )
{
std::stringstream s( input );
int i;
......
......@@ -7,7 +7,7 @@ namespace hive { namespace utilities {
typedef std::function<void(const char* key)> TScanErrorCallback;
unsigned long long read_u64_value_from(FILE* input, const char* key, unsigned key_length, TScanErrorCallback error_callback)
unsigned long long read_u64_value_from(FILE* input, const char* key, unsigned key_length, const TScanErrorCallback& error_callback)
{
char line_buffer[PROC_STATUS_LINE_LENGTH];
while( fgets(line_buffer, PROC_STATUS_LINE_LENGTH, input) != nullptr )
......@@ -33,7 +33,7 @@ unsigned long long read_u64_value_from(FILE* input, const char* key, unsigned ke
bool benchmark_dumper::read_mem(pid_t pid, uint64_t* current_virtual, uint64_t* peak_virtual)
{
const char* procPath = "/proc/self/status";
FILE* input = fopen(procPath, "r");
FILE* input = fopen(procPath, "re");
if(input == NULL)
{
elog( "cannot read: ${file} file.", ("file", procPath) );
......
......@@ -78,7 +78,7 @@ fc::optional<fc::logging_config> load_logging_config( const boost::program_optio
for( string& s : all_appenders )
{
std::size_t pos = 0;
while ((pos = s.find("{", pos)) != std::string::npos)
while ((pos = s.find('{', pos)) != std::string::npos)
{
auto appender = fc::json::from_string( s.substr( pos++ ) ).as< appender_args >();
appender.validate();
......@@ -128,7 +128,7 @@ fc::optional<fc::logging_config> load_logging_config( const boost::program_optio
for( string& s : loggers )
{
std::size_t pos = 0;
while ((pos = s.find("{", pos)) != std::string::npos)
while ((pos = s.find('{', pos)) != std::string::npos)
{
auto logger = fc::json::from_string( s.substr( pos++ ) ).as< logger_args >();
......
......@@ -66,25 +66,7 @@ struct remote_node_api
bool verify_account_authority( string, flat_set< public_key_type > );
vector< tags::vote_state > get_active_votes( account_name_type, string );
vector< condenser_api::account_vote > get_account_votes( account_name_type );
condenser_api::discussion get_content( account_name_type, string );
vector< condenser_api::discussion > get_content_replies( account_name_type, string );
vector< tags::tag_count_object > get_tags_used_by_author( account_name_type );
vector< condenser_api::discussion > get_discussions_by_payout( tags::discussion_query );
vector< condenser_api::discussion > get_post_discussions_by_payout( tags::discussion_query );
vector< condenser_api::discussion > get_comment_discussions_by_payout( tags::discussion_query );
vector< condenser_api::discussion > get_discussions_by_trending( tags::discussion_query );
vector< condenser_api::discussion > get_discussions_by_created( tags::discussion_query );
vector< condenser_api::discussion > get_discussions_by_active( tags::discussion_query );
vector< condenser_api::discussion > get_discussions_by_cashout( tags::discussion_query );
vector< condenser_api::discussion > get_discussions_by_votes( tags::discussion_query );
vector< condenser_api::discussion > get_discussions_by_children( tags::discussion_query );
vector< condenser_api::discussion > get_discussions_by_hot( tags::discussion_query );
vector< condenser_api::discussion > get_discussions_by_feed( tags::discussion_query );
vector< condenser_api::discussion > get_discussions_by_blog( tags::discussion_query );
vector< condenser_api::discussion > get_discussions_by_comments( tags::discussion_query );
vector< condenser_api::discussion > get_discussions_by_promoted( tags::discussion_query );
vector< condenser_api::discussion > get_replies_by_last_update( tags::discussion_query );
vector< condenser_api::discussion > get_discussions_by_author_before_date( tags::discussion_query );
map< uint32_t, condenser_api::api_operation_object > get_account_history( account_name_type, uint64_t, uint32_t );
void broadcast_transaction( condenser_api::legacy_signed_transaction );
condenser_api::broadcast_transaction_synchronous_return broadcast_transaction_synchronous( condenser_api::legacy_signed_transaction );
......@@ -106,6 +88,7 @@ struct remote_node_api
vector< condenser_api::market_trade > get_recent_trades( uint32_t );
vector< market_history::bucket_object > get_market_history( uint32_t, time_point_sec, time_point_sec );
flat_set< uint32_t > get_market_history_buckets();
bool is_known_transaction( const transaction_id_type& id )const;
vector< condenser_api::api_proposal_object > list_proposals( fc::variant, uint32_t, database_api::sort_order_type, database_api::order_direction_type, database_api::proposal_status );
vector< condenser_api::api_proposal_object > find_proposals( vector< int64_t > );
vector< database_api::api_proposal_vote_object > list_proposal_votes( fc::variant, uint32_t, database_api::sort_order_type, database_api::order_direction_type, database_api::proposal_status );
......@@ -159,25 +142,7 @@ FC_API( hive::wallet::remote_node_api,
(verify_account_authority)
(get_active_votes)
(get_account_votes)
(get_content)
(get_content_replies)
(get_tags_used_by_author)
(get_discussions_by_payout)
(get_post_discussions_by_payout)
(get_comment_discussions_by_payout)
(get_discussions_by_trending)
(get_discussions_by_created)
(get_discussions_by_active)
(get_discussions_by_cashout)
(get_discussions_by_votes)
(get_discussions_by_children)
(get_discussions_by_hot)
(get_discussions_by_feed)
(get_discussions_by_blog)
(get_discussions_by_comments)
(get_discussions_by_promoted)
(get_replies_by_last_update)
(get_discussions_by_author_before_date)
(get_account_history)
(broadcast_transaction)
(broadcast_transaction_synchronous)
......@@ -199,6 +164,7 @@ FC_API( hive::wallet::remote_node_api,
(get_recent_trades)
(get_market_history)
(get_market_history_buckets)
(is_known_transaction)
(list_proposals)
(find_proposals)
(list_proposal_votes)
......
......@@ -4,391 +4,361 @@ namespace hive { namespace wallet{
// This class exists only to provide method signature information to fc::api, not to execute calls.
// NOLINTNEXTLINE
condenser_api::get_version_return remote_node_api::get_version()
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< condenser_api::api_tag_object > remote_node_api::get_trending_tags( string, uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
condenser_api::state remote_node_api::get_state( string )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< account_name_type > remote_node_api::get_active_witnesses()
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
optional< block_header > remote_node_api::get_block_header( uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
optional< condenser_api::legacy_signed_block > remote_node_api::get_block( uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< condenser_api::api_operation_object > remote_node_api::get_ops_in_block( uint32_t, bool only_virtual )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
fc::variant_object remote_node_api::get_config()
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
condenser_api::extended_dynamic_global_properties remote_node_api::get_dynamic_global_properties()
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
condenser_api::api_chain_properties remote_node_api::get_chain_properties()
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
condenser_api::legacy_price remote_node_api::get_current_median_history_price()
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
condenser_api::api_feed_history_object remote_node_api::get_feed_history()
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
condenser_api::api_witness_schedule_object remote_node_api::get_witness_schedule()
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
hardfork_version remote_node_api::get_hardfork_version()
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
condenser_api::scheduled_hardfork remote_node_api::get_next_scheduled_hardfork()
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
condenser_api::api_reward_fund_object remote_node_api::get_reward_fund( string )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< vector< account_name_type > > remote_node_api::get_key_references( vector< public_key_type > )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< condenser_api::extended_account > remote_node_api::get_accounts( vector< account_name_type > )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< account_id_type > remote_node_api::get_account_references( account_id_type account_id )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< optional< condenser_api::api_account_object > > remote_node_api::lookup_account_names( vector< account_name_type > )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< account_name_type > remote_node_api::lookup_accounts( account_name_type, uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
uint64_t remote_node_api::get_account_count()
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< database_api::api_owner_authority_history_object > remote_node_api::get_owner_history( account_name_type )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
optional< database_api::api_account_recovery_request_object > remote_node_api::get_recovery_request( account_name_type )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
optional< condenser_api::api_escrow_object > remote_node_api::get_escrow( account_name_type, uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< database_api::api_withdraw_vesting_route_object > remote_node_api::get_withdraw_routes( account_name_type, condenser_api::withdraw_route_type )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< condenser_api::api_savings_withdraw_object > remote_node_api::get_savings_withdraw_from( account_name_type )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< condenser_api::api_savings_withdraw_object > remote_node_api::get_savings_withdraw_to( account_name_type )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< condenser_api::api_vesting_delegation_object > remote_node_api::get_vesting_delegations( account_name_type, account_name_type, uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< condenser_api::api_vesting_delegation_expiration_object > remote_node_api::get_expiring_vesting_delegations( account_name_type, time_point_sec, uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< optional< condenser_api::api_witness_object > > remote_node_api::get_witnesses( vector< witness_id_type > )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< condenser_api::api_convert_request_object > remote_node_api::get_conversion_requests( account_name_type )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
optional< condenser_api::api_witness_object > remote_node_api::get_witness_by_account( account_name_type )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< condenser_api::api_witness_object > remote_node_api::get_witnesses_by_vote( account_name_type, uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< account_name_type > remote_node_api::lookup_witness_accounts( string, uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
uint64_t remote_node_api::get_witness_count()
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< condenser_api::api_limit_order_object > remote_node_api::get_open_orders( account_name_type )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
string remote_node_api::get_transaction_hex( condenser_api::legacy_signed_transaction )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
condenser_api::legacy_signed_transaction remote_node_api::get_transaction( transaction_id_type )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
set< public_key_type > remote_node_api::get_required_signatures( condenser_api::legacy_signed_transaction, flat_set< public_key_type > )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
set< public_key_type > remote_node_api::get_potential_signatures( condenser_api::legacy_signed_transaction )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
bool remote_node_api::verify_authority( condenser_api::legacy_signed_transaction )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
bool remote_node_api::verify_account_authority( string, flat_set< public_key_type > )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< tags::vote_state > remote_node_api::get_active_votes( account_name_type, string )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< condenser_api::account_vote > remote_node_api::get_account_votes( account_name_type )
{
FC_ASSERT( false );
}
condenser_api::discussion remote_node_api::get_content( account_name_type, string )
{
FC_ASSERT( false );
}
vector< condenser_api::discussion > remote_node_api::get_content_replies( account_name_type, string )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< tags::tag_count_object > remote_node_api::get_tags_used_by_author( account_name_type )
{
FC_ASSERT( false );
}
vector< condenser_api::discussion > remote_node_api::get_discussions_by_payout( tags::discussion_query )
{
FC_ASSERT( false );
}
vector< condenser_api::discussion > remote_node_api::get_post_discussions_by_payout( tags::discussion_query )
{
FC_ASSERT( false );
}
vector< condenser_api::discussion > remote_node_api::get_comment_discussions_by_payout( tags::discussion_query )
{
FC_ASSERT( false );
}
vector< condenser_api::discussion > remote_node_api::get_discussions_by_trending( tags::discussion_query )
{
FC_ASSERT( false );
}
vector< condenser_api::discussion > remote_node_api::get_discussions_by_created( tags::discussion_query )
{
FC_ASSERT( false );
}
vector< condenser_api::discussion > remote_node_api::get_discussions_by_active( tags::discussion_query )
{
FC_ASSERT( false );
}
vector< condenser_api::discussion > remote_node_api::get_discussions_by_cashout( tags::discussion_query )
{
FC_ASSERT( false );
}
vector< condenser_api::discussion > remote_node_api::get_discussions_by_votes( tags::discussion_query )
{
FC_ASSERT( false );
}
vector< condenser_api::discussion > remote_node_api::get_discussions_by_children( tags::discussion_query )
{
FC_ASSERT( false );
}
vector< condenser_api::discussion > remote_node_api::get_discussions_by_hot( tags::discussion_query )
{
FC_ASSERT( false );
}
vector< condenser_api::discussion > remote_node_api::get_discussions_by_feed( tags::discussion_query )
{
FC_ASSERT( false );
}
vector< condenser_api::discussion > remote_node_api::get_discussions_by_blog( tags::discussion_query )
{
FC_ASSERT( false );
}
vector< condenser_api::discussion > remote_node_api::get_discussions_by_comments( tags::discussion_query )
{
FC_ASSERT( false );
}
vector< condenser_api::discussion > remote_node_api::get_discussions_by_promoted( tags::discussion_query )
{
FC_ASSERT( false );
}
vector< condenser_api::discussion > remote_node_api::get_replies_by_last_update( tags::discussion_query )
{
FC_ASSERT( false );
}
vector< condenser_api::discussion > remote_node_api::get_discussions_by_author_before_date( tags::discussion_query )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
map< uint32_t, condenser_api::api_operation_object > remote_node_api::get_account_history( account_name_type, uint64_t, uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
void remote_node_api::broadcast_transaction( condenser_api::legacy_signed_transaction )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
condenser_api::broadcast_transaction_synchronous_return remote_node_api::broadcast_transaction_synchronous( condenser_api::legacy_signed_transaction )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
void remote_node_api::broadcast_block( signed_block )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< follow::api_follow_object > remote_node_api::get_followers( account_name_type, account_name_type, follow::follow_type, uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< follow::api_follow_object > remote_node_api::get_following( account_name_type, account_name_type, follow::follow_type, uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
follow::get_follow_count_return remote_node_api::get_follow_count( account_name_type )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< follow::feed_entry > remote_node_api::get_feed_entries( account_name_type, uint32_t, uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< follow::comment_feed_entry > remote_node_api::get_feed( account_name_type, uint32_t, uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< follow::blog_entry > remote_node_api::get_blog_entries( account_name_type, uint32_t, uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< follow::comment_blog_entry > remote_node_api::get_blog( account_name_type, uint32_t, uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< follow::account_reputation > remote_node_api::get_account_reputations( account_name_type, uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< account_name_type > remote_node_api::get_reblogged_by( account_name_type, string )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< follow::reblog_count > remote_node_api::get_blog_authors( account_name_type )
{
FC_ASSERT( false );
......@@ -409,16 +379,19 @@ condenser_api::get_order_book_return remote_node_api::get_order_book( uint32_t )
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< condenser_api::market_trade > remote_node_api::get_trade_history( time_point_sec, time_point_sec, uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< condenser_api::market_trade > remote_node_api::get_recent_trades( uint32_t )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< market_history::bucket_object > remote_node_api::get_market_history( uint32_t, time_point_sec, time_point_sec )
{
FC_ASSERT( false );
......@@ -429,16 +402,23 @@ flat_set< uint32_t > remote_node_api::get_market_history_buckets()
FC_ASSERT( false );
}
bool remote_node_api::is_known_transaction( const transaction_id_type& id )const
{
FC_ASSERT( false );
}
vector< condenser_api::api_proposal_object > remote_node_api::list_proposals( fc::variant, uint32_t, database_api::sort_order_type, database_api::order_direction_type, database_api::proposal_status )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< condenser_api::api_proposal_object > remote_node_api::find_proposals( vector< int64_t > )
{
FC_ASSERT( false );
}
// NOLINTNEXTLINE
vector< database_api::api_proposal_vote_object > remote_node_api::list_proposal_votes( fc::variant, uint32_t, database_api::sort_order_type, database_api::order_direction_type, database_api::proposal_status )
{
FC_ASSERT( false );
......
This diff is collapsed.
......@@ -69,16 +69,21 @@ namespace bpo = boost::program_options;
int main( int argc, char** argv )
{
try {
const char* raw_password_from_environment = std::getenv("HIVE_WALLET_PASSWORD");
std::string unlock_password_from_environment = raw_password_from_environment ? raw_password_from_environment : "";
boost::program_options::options_description opts;
opts.add_options()
("help,h", "Print this help message and exit.")
("server-rpc-endpoint,s", bpo::value<string>()->implicit_value("ws://127.0.0.1:8090"), "Server websocket RPC endpoint")
("cert-authority,a", bpo::value<string>()->default_value("_default"), "Trusted CA bundle file for connecting to wss:// TLS server")
("retry-server-connection", "Keep trying to connect to the Server websocket RPC endpoint if the first attempt fails")
("rpc-endpoint,r", bpo::value<string>()->implicit_value("127.0.0.1:8091"), "Endpoint for wallet websocket RPC to listen on")
("rpc-tls-endpoint,t", bpo::value<string>()->implicit_value("127.0.0.1:8092"), "Endpoint for wallet websocket TLS RPC to listen on")
("rpc-tls-certificate,c", bpo::value<string>()->implicit_value("server.pem"), "PEM certificate for wallet websocket TLS RPC")
("rpc-http-endpoint,H", bpo::value<string>()->implicit_value("127.0.0.1:8093"), "Endpoint for wallet HTTP RPC to listen on")
("unlock", bpo::value<string>()->implicit_value(unlock_password_from_environment), "Password to automatically unlock wallet with "
"or use HIVE_WALLET_PASSWORD environment variable if no password is supplied")
("daemon,d", "Run the wallet in daemon mode" )
("rpc-http-allowip", bpo::value<vector<string>>()->multitoken(), "Allows only specified IPs to connect to the HTTP endpoint" )
("wallet-file,w", bpo::value<string>()->implicit_value("wallet.json"), "wallet to load")
......@@ -163,7 +168,28 @@ int main( int argc, char** argv )
fc::http::websocket_client client( options["cert-authority"].as<std::string>() );
idump((wdata.ws_server));
auto con = client.connect( wdata.ws_server );
fc::http::websocket_connection_ptr con;
for (;;)
{
try
{
con = client.connect( wdata.ws_server );
}
catch (const fc::exception& e)
{
if (!options.count("retry-server-connection"))
throw;
}
if (con)
break;
else
{
wlog("Error connecting to server RPC endpoint, retrying in 10 seconds");
fc::usleep(fc::seconds(10));
}
}
auto apic = std::make_shared<fc::rpc::websocket_api_connection>(*con);
auto remote_api = apic->get_remote_api< hive::wallet::remote_node_api >( 0, "condenser_api" );
......@@ -243,8 +269,8 @@ int main( int argc, char** argv )
_http_server->on_request(
[&]( const fc::http::request& req, const fc::http::server::response& resp )
{
auto itr = allowed_ip_set.find( fc::ip::endpoint::from_string(req.remote_endpoint).get_address() );
if( itr == allowed_ip_set.end() ) {
if( allowed_ip_set.find( fc::ip::endpoint::from_string(req.remote_endpoint).get_address() ) == allowed_ip_set.end() &&
allowed_ip_set.find( fc::ip::address() ) == allowed_ip_set.end() ) {
elog("rejected connection from ${ip} because it isn't in allowed set ${s}", ("ip",req.remote_endpoint)("s",allowed_ip_set) );
resp.set_status( fc::http::reply::NotAuthorized );
return;
......@@ -256,6 +282,10 @@ int main( int argc, char** argv )
} );
}
if( options.count("unlock" ) ) {
wapi->unlock( options.at("unlock").as<string>() );
}
if( !options.count( "daemon" ) )
{
wallet_cli->register_api( wapi );
......
......@@ -32,7 +32,6 @@
namespace bpo = boost::program_options;
using hive::protocol::version;
using std::string;
using std::vector;
string& version_string()
{
......
......@@ -354,3 +354,38 @@ def junit_test_case(method):
junit_test_cases.append(test_case)
return log_test_case
# calculating md5 checsums for all files
def get_index_checksums(path : str):
from subprocess import run, PIPE
import os
# gather files and paths for md5sum
files = run(["find", path, "-type", "f" ], stdout=PIPE).stdout.decode('utf-8').splitlines()
temp_files = []
for file in files:
if file.find('snapshot-manifest') < 0:
temp_files.append(file)
files = temp_files
# calculate md5sum
files_with_md5 = dict()
for file in files:
md5, _, output = run(["md5sum", file ], stdout=PIPE).stdout.decode('utf-8').strip().split(' ')
output = os.path.split(os.path.split(output)[0])[1]
files_with_md5[output] = md5
return files_with_md5
# return list of missmatched indexes
def compare_snapshots(path_to_first_snapshot : str, path_to_second_snapshot : str) -> list:
first_ret = get_index_checksums(path_to_first_snapshot)
second_ret = get_index_checksums(path_to_second_snapshot)
keys = first_ret.keys()
ret = []
for key in keys:
first_md5 = first_ret[key]
second_md5 = second_ret[key]
if first_md5 != second_md5:
ret.append(key)
return ret
......@@ -31,7 +31,7 @@ class HiveNode(object):
hived_data_dir = None
hived_args = list()
def __init__(self, binary_path : str, working_dir : str, binary_args : list):
def __init__(self, binary_path : str, working_dir : str, binary_args : list, stdout_stream = subprocess.PIPE, stderr_stream = None):
logger.info("New hive node")
if not os.path.exists(binary_path):
raise ValueError("Path to hived binary is not valid.")
......@@ -48,10 +48,13 @@ class HiveNode(object):
if binary_args:
self.hived_args.extend(binary_args)
self.stdout_stream = stdout_stream
self.stderr_stream = stderr_stream
def __enter__(self):
self.hived_lock.acquire()
from subprocess import Popen, PIPE
from subprocess import Popen, PIPE, DEVNULL
from time import sleep
hived_command = [
......@@ -60,12 +63,14 @@ class HiveNode(object):
]
hived_command.extend(self.hived_args)
self.hived_process = Popen(hived_command, stdout=PIPE, stderr=None)
self.hived_process = Popen(hived_command, stdout=self.stdout_stream, stderr=self.stderr_stream)
self.hived_process.poll()
sleep(5)
if self.hived_process.returncode:
raise Exception("Error during starting node")
self.last_returncode = None
def get_output(self):
out, err = self.hived_process.communicate()
......@@ -75,22 +80,36 @@ class HiveNode(object):
logger.info("Closing node")
from signal import SIGINT, SIGTERM
from time import sleep
from psutil import pid_exists
if self.hived_process is not None:
self.hived_process.poll()
if self.hived_process.returncode != 0:
if pid_exists(self.hived_process.pid):
self.hived_process.send_signal(SIGINT)
sleep(7)
self.hived_process.poll()
if self.hived_process.returncode != 0:
if pid_exists(self.hived_process.pid):
self.hived_process.send_signal(SIGTERM)
sleep(7)
self.hived_process.poll()
if self.hived_process.returncode != 0:
if pid_exists(self.hived_process.pid):
raise Exception("Error during stopping node. Manual intervention required.")
self.last_returncode = self.hived_process.returncode
self.hived_process = None
self.hived_lock.release()
# waits for node, to close. Recomended to use with `--exit-after-replay` flag
def wait_till_end(self):
assert self.hived_process is not None
# assert "--exit-after-replay" in self.hived_args
from time import sleep
from psutil import pid_exists, Process, STATUS_ZOMBIE
pid = self.hived_process.pid
while pid_exists(pid) and Process(pid).status() != STATUS_ZOMBIE:
sleep(0.25)
class HiveNodeInScreen(object):
def __init__(self, hive_executable, working_dir, config_src_path, run_using_existing_data = False, node_is_steem = False):
self.hive_executable = hive_executable
......@@ -155,9 +174,7 @@ class HiveNodeInScreen(object):
self.hive_executable,
"-d",
self.working_dir,
"--advanced-benchmark",
"--sps-remove-threshold",
"-1"
"--advanced-benchmark"
]
parameters = parameters + additional_params
......