Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Commit

Permalink
Added HF19 checks. Fixed auction_window_size in update_chain_properti…
Browse files Browse the repository at this point in the history
…es. #898
  • Loading branch information
AKorpusenko committed Aug 30, 2018
1 parent 8afba75 commit df50402
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 29 deletions.
6 changes: 4 additions & 2 deletions libraries/api/discussion_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@ namespace golos { namespace api {
}
}

auto reward_fund_claim = ((max_rewards.value * d.auction_window_weight) / total_weight).to_uint64();
unclaimed_rewards -= reward_fund_claim;
if (db.has_hardfork(STEEMIT_HARDFORK_0_19__898)) {
auto reward_fund_claim = ((max_rewards.value * d.auction_window_weight) / total_weight).to_uint64();
unclaimed_rewards -= reward_fund_claim;
}
}
} else {
unclaimed_rewards = 0;
Expand Down
2 changes: 1 addition & 1 deletion libraries/api/include/golos/api/chain_api_properties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ FC_REFLECT(
(account_creation_fee)(maximum_block_size)(sbd_interest_rate)
(create_account_min_golos_fee)(create_account_min_delegation)
(create_account_delegation_time)(min_delegation)
(max_referral_interest_rate)(max_referral_term_sec)(max_referral_break_fee))
(max_referral_interest_rate)(max_referral_term_sec)(max_referral_break_fee)(auction_window_size))
2 changes: 1 addition & 1 deletion libraries/chain/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2287,7 +2287,7 @@ namespace golos { namespace chain {

unclaimed_rewards = 0;
}
else if (c.total_vote_weight > 0) {
else if (has_hardfork(STEEMIT_HARDFORK_0_19__898) && c.total_vote_weight > 0) {
auto reward_fund_claim = (max_rewards.value * c.auction_window_weight) / total_weight;
unclaimed_rewards -= reward_fund_claim.to_uint64();
modify(get_dynamic_global_properties(), [&](dynamic_global_property_object &props) {
Expand Down
1 change: 1 addition & 0 deletions libraries/chain/hardfork.d/0_19.hf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#ifndef STEEMIT_HARDFORK_0_19
#define STEEMIT_HARDFORK_0_19 19
#define STEEMIT_HARDFORK_0_19__898 (STEEMIT_HARDFORK_0_19) // Add votable auction window size

#ifdef STEEMIT_BUILD_TESTNET
#define STEEMIT_HARDFORK_0_19_TIME 1534755600 // 20 aug 2018 12:00:00 MSK
Expand Down
23 changes: 0 additions & 23 deletions libraries/protocol/include/golos/protocol/steem_operations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,6 @@ namespace golos { namespace protocol {
}

chain_properties_18& operator=(const chain_properties_18&) = default;

chain_properties_18& operator=(const chain_properties_19& src);
};

/**
Expand Down Expand Up @@ -531,19 +529,6 @@ namespace golos { namespace protocol {
chain_properties_18::operator=(src);
return *this;
}

chain_properties_19& operator=(const chain_properties_18& src) {
// 18
create_account_min_golos_fee = src.create_account_min_golos_fee;
create_account_min_delegation = src.create_account_min_delegation;
create_account_delegation_time = src.create_account_delegation_time;
min_delegation = src.min_delegation;
// 17
account_creation_fee = src.account_creation_fee;
maximum_block_size = src.maximum_block_size;
sbd_interest_rate = src.sbd_interest_rate;
return *this;
}

chain_properties_19& operator=(const chain_properties_19&) = default;
};
Expand All @@ -555,14 +540,6 @@ namespace golos { namespace protocol {
return *this;
}

inline chain_properties_18& chain_properties_18::operator=(const chain_properties_19& src) {
create_account_min_golos_fee = src.create_account_min_golos_fee;
create_account_min_delegation = src.create_account_min_delegation;
create_account_delegation_time = src.create_account_delegation_time;
min_delegation = src.min_delegation;
return *this;
}

using versioned_chain_properties = fc::static_variant<
chain_properties_17,
chain_properties_18,
Expand Down
2 changes: 1 addition & 1 deletion libraries/protocol/steem_operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ namespace golos { namespace protocol {

void chain_properties_19::validate() const {
chain_properties_18::validate();
GOLOS_CHECK_VALUE_GT(auction_window_size, 0);
GOLOS_CHECK_VALUE_LEGE(auction_window_size, 0, (24 * 60 * 60));
GOLOS_CHECK_VALUE_LE(max_referral_interest_rate, GOLOS_MAX_REFERRAL_INTEREST_RATE);
GOLOS_CHECK_VALUE_LE(max_referral_term_sec, GOLOS_MAX_REFERRAL_TERM_SEC);
GOLOS_CHECK_VALUE_LEGE(max_referral_break_fee.amount, 0, GOLOS_MAX_REFERRAL_BREAK_FEE.amount);
Expand Down
2 changes: 1 addition & 1 deletion libraries/wallet/include/golos/wallet/wallet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ FC_REFLECT((golos::wallet::optional_chain_props),
(account_creation_fee)(maximum_block_size)(sbd_interest_rate)
(create_account_min_golos_fee)(create_account_min_delegation)
(create_account_delegation_time)(min_delegation)
(max_referral_interest_rate)(max_referral_term_sec)(max_referral_break_fee))
(max_referral_interest_rate)(max_referral_term_sec)(max_referral_break_fee)(auction_window_size))

FC_REFLECT(
(golos::wallet::message_body),
Expand Down

0 comments on commit df50402

Please sign in to comment.