Skip to content

Commit

Permalink
feat: post upgrade 2024 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fpelliccioni committed May 21, 2024
1 parent 6dd0e78 commit 52334fb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
12 changes: 8 additions & 4 deletions include/kth/blockchain/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ class BCB_API settings {
// 2021-May (no HF)
bool bch_gauss = true; // 2022-May
bool bch_descartes = true; // 2023-May
// bool bch_lobachevski = false; // 2024-May
bool bch_lobachevski = true; // 2024-May
// bool bch_galois = false; // 2025-May
// bool bch_leibniz = false; // 2026-May

// bool bch_unnamed = false; // 2026-May
// bool bch_unnamed = false; // 2027-May

////2017-Aug-01 hard fork, defaults to 478559 (Mainnet)
// size_t uahf_height = 478559;
Expand Down Expand Up @@ -97,12 +98,15 @@ class BCB_API settings {
// //2023-May-15 hard fork, defaults to 1684152000: May 15, 2023 12:00:00 UTC protocol upgrade
// uint64_t descartes_activation_time = to_underlying(bch_descartes_activation_time);

//2024-May-15 hard fork, defaults to 1715774400: May 15, 2024 12:00:00 UTC protocol upgrade
uint64_t lobachevski_activation_time = to_underlying(bch_lobachevski_activation_time);
// //2024-May-15 hard fork, defaults to 1715774400: May 15, 2024 12:00:00 UTC protocol upgrade
// uint64_t lobachevski_activation_time = to_underlying(bch_lobachevski_activation_time);

//2025-May-15 hard fork, defaults to 1747310400: May 15, 2025 12:00:00 UTC protocol upgrade
uint64_t galois_activation_time = to_underlying(bch_galois_activation_time);

// 2026-May-15 hard fork, defaults to 1778846400: May 15, 2026 12:00:00 UTC protocol upgrade
uint64_t leibniz_activation_time = to_underlying(bch_leibniz_activation_time);

// //????-???-?? hard fork, defaults to 9999999999: ??? ??, ???? 12:00:00 UTC protocol upgrade
// uint64_t unnamed_activation_time = to_underlying(bch_unnamed_activation_time);

Expand Down
14 changes: 10 additions & 4 deletions src/populate/populate_chain_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,9 @@ chain_state::ptr populate_chain_state::populate() const {
// , euler_t(settings_.euler_activation_time)
// , gauss_t(settings_.gauss_activation_time)
// , descartes_t(settings_.descartes_activation_time)
, lobachevski_t(settings_.lobachevski_activation_time)
// , lobachevski_t(settings_.lobachevski_activation_time)
, galois_t(settings_.galois_activation_time)
, leibniz_t(settings_.leibniz_activation_time)
#endif //KTH_CURRENCY_BCH
);

Expand All @@ -306,16 +307,20 @@ chain_state::ptr populate_chain_state::populate(chain_state::ptr pool, branch::c
return chain_state::from_pool_ptr(*pool, *block);
}

auto const height = branch->top_height();
chain_state::data data;
data.hash = block->hash();
data.height = branch->top_height();
data.height = height;

// Caller must test result.
if ( ! populate_all(data, branch)) {
return {};
}

auto const is_lobachevski_enabled = chain_state::is_mtp_activated(chain_state::median_time_past(data), settings_.lobachevski_activation_time);
// Before activating lobachevski, we need to check if it is enabled using the median time past.
// auto const is_lobachevski_enabled = chain_state::is_mtp_activated(chain_state::median_time_past(data), settings_.lobachevski_activation_time);
// After activating lobachevski, we need to check if it is enabled using the height.
auto const is_lobachevski_enabled = chain_state::is_lobachevski_enabled(height, network_);
if (is_lobachevski_enabled) {
if ( ! pool->is_lobachevski_enabled()) {
data.abla_state = abla::state(settings_.abla_config, block->serialized_size(1));
Expand Down Expand Up @@ -347,8 +352,9 @@ chain_state::ptr populate_chain_state::populate(chain_state::ptr pool, branch::c
// , euler_t(settings_.euler_activation_time)
// , gauss_t(settings_.gauss_activation_time)
// , descartes_t(settings_.descartes_activation_time)
, lobachevski_t(settings_.lobachevski_activation_time)
// , lobachevski_t(settings_.lobachevski_activation_time)
, galois_t(settings_.galois_activation_time)
, leibniz_t(settings_.leibniz_activation_time)
#endif //KTH_CURRENCY_BCH
);
}
Expand Down

0 comments on commit 52334fb

Please sign in to comment.