Remove final vote canary code as final votes are now always enabled. (#4502)
This commit is contained in:
parent
5710405365
commit
f64d965321
7 changed files with 3 additions and 50 deletions
|
@ -190,16 +190,6 @@ void nano::active_transactions::notify_observers (nano::election_status const &
|
|||
void nano::active_transactions::handle_final_votes_confirmation (std::shared_ptr<nano::block> const & block, nano::store::read_transaction const & transaction, nano::election_status_type status)
|
||||
{
|
||||
auto account = block->account ();
|
||||
|
||||
bool is_canary_not_set = !node.ledger.cache.final_votes_confirmation_canary.load ();
|
||||
bool is_canary_account = account == node.network_params.ledger.final_votes_canary_account;
|
||||
bool is_height_above_threshold = block->sideband ().height >= node.network_params.ledger.final_votes_canary_height;
|
||||
|
||||
if (is_canary_not_set && is_canary_account && is_height_above_threshold)
|
||||
{
|
||||
node.ledger.cache.final_votes_confirmation_canary.store (true);
|
||||
}
|
||||
|
||||
bool cemented_bootstrap_count_reached = node.ledger.cache.cemented_count >= node.ledger.bootstrap_weight_max_blocks;
|
||||
bool was_active = status == nano::election_status_type::active_confirmed_quorum || status == nano::election_status_type::active_confirmation_height;
|
||||
|
||||
|
|
|
@ -397,11 +397,11 @@ void nano::election::confirm_if_quorum (nano::unique_lock<nano::mutex> & lock_a)
|
|||
}
|
||||
if (have_quorum (tally_l))
|
||||
{
|
||||
if (node.ledger.cache.final_votes_confirmation_canary.load () && !is_quorum.exchange (true) && node.config.enable_voting && node.wallets.reps ().voting > 0)
|
||||
if (!is_quorum.exchange (true) && node.config.enable_voting && node.wallets.reps ().voting > 0)
|
||||
{
|
||||
node.final_generator.add (root, status.winner->hash ());
|
||||
}
|
||||
if (!node.ledger.cache.final_votes_confirmation_canary.load () || final_weight >= node.online_reps.delta ())
|
||||
if (final_weight >= node.online_reps.delta ())
|
||||
{
|
||||
confirm_once (lock_a, nano::election_status_type::active_confirmed_quorum);
|
||||
}
|
||||
|
|
|
@ -70,10 +70,6 @@ std::shared_ptr<nano::block> parse_block_from_genesis_data (std::string const &
|
|||
boost::property_tree::read_json (istream, tree);
|
||||
return nano::deserialize_block_json (tree);
|
||||
}
|
||||
|
||||
char const * beta_canary_public_key_data = "259a438a8f9f9226130c84d902c237af3e57c0981c7d709c288046b110d8c8ac"; // nano_33nefchqmo4ifr3bpfw4ecwjcg87semfhit8prwi7zzd8shjr8c9qdxeqmnx
|
||||
char const * live_canary_public_key_data = "7CBAF192A3763DAEC9F9BAC1B2CDF665D8369F8400B4BC5AB4BA31C00BAA4404"; // nano_1z7ty8bc8xjxou6zmgp3pd8zesgr8thra17nqjfdbgjjr17tnj16fjntfqfn
|
||||
std::string const test_canary_public_key_data = nano::get_env_or_default ("NANO_TEST_CANARY_PUB", "3BAD2C554ACE05F5E528FBBCE79D51E552C55FA765CCFD89B289C4835DE5F04A"); // nano_1gxf7jcnomi7yqkkjyxwwygo5sckrohtgsgezp6u74g6ifgydw4cajwbk8bf
|
||||
}
|
||||
|
||||
nano::keypair nano::dev::genesis_key{ dev_private_key_data };
|
||||
|
@ -111,21 +107,7 @@ nano::ledger_constants::ledger_constants (nano::work_thresholds & work, nano::ne
|
|||
: network_a == nano::networks::nano_test_network ? nano_test_genesis
|
||||
: nano_live_genesis),
|
||||
genesis_amount{ std::numeric_limits<nano::uint128_t>::max () },
|
||||
burn_account{},
|
||||
nano_dev_final_votes_canary_account (dev_public_key_data),
|
||||
nano_beta_final_votes_canary_account (beta_canary_public_key_data),
|
||||
nano_live_final_votes_canary_account (live_canary_public_key_data),
|
||||
nano_test_final_votes_canary_account (test_canary_public_key_data),
|
||||
final_votes_canary_account (network_a == nano::networks::nano_dev_network ? nano_dev_final_votes_canary_account : network_a == nano::networks::nano_beta_network ? nano_beta_final_votes_canary_account
|
||||
: network_a == nano::networks::nano_test_network ? nano_test_final_votes_canary_account
|
||||
: nano_live_final_votes_canary_account),
|
||||
nano_dev_final_votes_canary_height (1),
|
||||
nano_beta_final_votes_canary_height (1),
|
||||
nano_live_final_votes_canary_height (1),
|
||||
nano_test_final_votes_canary_height (1),
|
||||
final_votes_canary_height (network_a == nano::networks::nano_dev_network ? nano_dev_final_votes_canary_height : network_a == nano::networks::nano_beta_network ? nano_beta_final_votes_canary_height
|
||||
: network_a == nano::networks::nano_test_network ? nano_test_final_votes_canary_height
|
||||
: nano_live_final_votes_canary_height)
|
||||
burn_account{}
|
||||
{
|
||||
nano_beta_genesis->sideband_set (nano::block_sideband (nano_beta_genesis->account_field ().value (), 0, std::numeric_limits<nano::uint128_t>::max (), 1, nano::seconds_since_epoch (), nano::epoch::epoch_0, false, false, false, nano::epoch::epoch_0));
|
||||
nano_dev_genesis->sideband_set (nano::block_sideband (nano_dev_genesis->account_field ().value (), 0, std::numeric_limits<nano::uint128_t>::max (), 1, nano::seconds_since_epoch (), nano::epoch::epoch_0, false, false, false, nano::epoch::epoch_0));
|
||||
|
|
|
@ -249,16 +249,6 @@ public:
|
|||
std::shared_ptr<nano::block> genesis;
|
||||
nano::uint128_t genesis_amount;
|
||||
nano::account burn_account;
|
||||
nano::account nano_dev_final_votes_canary_account;
|
||||
nano::account nano_beta_final_votes_canary_account;
|
||||
nano::account nano_live_final_votes_canary_account;
|
||||
nano::account nano_test_final_votes_canary_account;
|
||||
nano::account final_votes_canary_account;
|
||||
uint64_t nano_dev_final_votes_canary_height;
|
||||
uint64_t nano_beta_final_votes_canary_height;
|
||||
uint64_t nano_live_final_votes_canary_height;
|
||||
uint64_t nano_test_final_votes_canary_height;
|
||||
uint64_t final_votes_canary_height;
|
||||
nano::epochs epochs;
|
||||
};
|
||||
|
||||
|
|
|
@ -796,13 +796,6 @@ void nano::ledger::initialize (nano::generate_cache_flags const & generate_cache
|
|||
|
||||
auto transaction (store.tx_begin_read ());
|
||||
cache.pruned_count = store.pruned.count (transaction);
|
||||
|
||||
// Final votes requirement for confirmation canary block
|
||||
nano::confirmation_height_info confirmation_height_info;
|
||||
if (!store.confirmation_height.get (transaction, constants.final_votes_canary_account, confirmation_height_info))
|
||||
{
|
||||
cache.final_votes_confirmation_canary = (confirmation_height_info.height >= constants.final_votes_canary_height);
|
||||
}
|
||||
}
|
||||
|
||||
// Balance for account containing hash
|
||||
|
|
|
@ -15,6 +15,5 @@ public:
|
|||
std::atomic<uint64_t> block_count{ 0 };
|
||||
std::atomic<uint64_t> pruned_count{ 0 };
|
||||
std::atomic<uint64_t> account_count{ 0 };
|
||||
std::atomic<bool> final_votes_confirmation_canary{ false };
|
||||
};
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ void nano::store::component::initialize (store::write_transaction const & transa
|
|||
++ledger_cache_a.block_count;
|
||||
confirmation_height.put (transaction_a, constants.genesis->account (), nano::confirmation_height_info{ 1, constants.genesis->hash () });
|
||||
++ledger_cache_a.cemented_count;
|
||||
ledger_cache_a.final_votes_confirmation_canary = (constants.final_votes_canary_account == constants.genesis->account () && 1 >= constants.final_votes_canary_height);
|
||||
account.put (transaction_a, constants.genesis->account (), { hash_l, constants.genesis->account (), constants.genesis->hash (), std::numeric_limits<nano::uint128_t>::max (), nano::seconds_since_epoch (), 1, nano::epoch::epoch_0 });
|
||||
++ledger_cache_a.account_count;
|
||||
ledger_cache_a.rep_weights.representation_put (constants.genesis->account (), std::numeric_limits<nano::uint128_t>::max ());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue