Removing genesis_account function since it can be directly queried easily.
This commit is contained in:
parent
91113e7d23
commit
e76f0c40cb
11 changed files with 20 additions and 28 deletions
|
@ -247,7 +247,7 @@ bool nano::bootstrap_attempt_lazy::process_block_lazy (std::shared_ptr<nano::blo
|
|||
if (!lazy_blocks_processed (hash))
|
||||
{
|
||||
// Search for new dependencies
|
||||
if (!block_a->source ().is_zero () && !node->ledger.block_or_pruned_exists (block_a->source ()) && block_a->source () != node->network_params.ledger.genesis_account ())
|
||||
if (!block_a->source ().is_zero () && !node->ledger.block_or_pruned_exists (block_a->source ()) && block_a->source () != node->network_params.ledger.genesis->account ())
|
||||
{
|
||||
lazy_add (block_a->source (), retry_limit);
|
||||
}
|
||||
|
|
|
@ -574,7 +574,7 @@ std::error_code nano::handle_node_options (boost::program_options::variables_map
|
|||
{
|
||||
auto transaction (node.node->store.tx_begin_write ());
|
||||
auto conf_height_reset_num = 0;
|
||||
if (account == node.node->network_params.ledger.genesis_account ())
|
||||
if (account == node.node->network_params.ledger.genesis->account ())
|
||||
{
|
||||
conf_height_reset_num = 1;
|
||||
node.node->store.confirmation_height.put (transaction, account, { confirmation_height_info.height, node.node->network_params.ledger.genesis->hash () });
|
||||
|
@ -1307,7 +1307,7 @@ void reset_confirmation_heights (nano::write_transaction const & transaction, na
|
|||
|
||||
// Then make sure the confirmation height of the genesis account open block is 1
|
||||
nano::network_params network_params;
|
||||
store.confirmation_height.put (transaction, network_params.ledger.genesis_account (), { 1, network_params.ledger.genesis->hash () });
|
||||
store.confirmation_height.put (transaction, network_params.ledger.genesis->account (), { 1, network_params.ledger.genesis->hash () });
|
||||
}
|
||||
|
||||
bool is_using_rocksdb (boost::filesystem::path const & data_path, boost::program_options::variables_map const & vm, std::error_code & ec)
|
||||
|
|
|
@ -1041,7 +1041,7 @@ void nano::json_handler::active_difficulty ()
|
|||
|
||||
void nano::json_handler::available_supply ()
|
||||
{
|
||||
auto genesis_balance (node.balance (node.network_params.ledger.genesis_account ())); // Cold storage genesis
|
||||
auto genesis_balance (node.balance (node.network_params.ledger.genesis->account ())); // Cold storage genesis
|
||||
auto landing_balance (node.balance (nano::account ("059F68AAB29DE0D3A27443625C7EA9CDDB6517A8B76FE37727EF6A4D76832AD5"))); // Active unavailable account
|
||||
auto faucet_balance (node.balance (nano::account ("8E319CE6F3025E5B2DF66DA7AB1467FE48F1679C13DD43BFDB29FA2E9FC40D3B"))); // Faucet account
|
||||
auto burned_balance ((node.balance_pending (nano::account (0), false)).second); // Burning 0 account
|
||||
|
@ -2318,7 +2318,7 @@ public:
|
|||
// Report opens as a receive
|
||||
tree.put ("type", "receive");
|
||||
}
|
||||
if (block_a.hashables.source != network_params.ledger.genesis_account ())
|
||||
if (block_a.hashables.source != network_params.ledger.genesis->account ())
|
||||
{
|
||||
bool error_or_pruned (false);
|
||||
auto amount (handler.node.ledger.amount_safe (transaction, hash, error_or_pruned).convert_to<std::string> ());
|
||||
|
@ -2334,7 +2334,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
tree.put ("account", network_params.ledger.genesis_account ().to_account ());
|
||||
tree.put ("account", network_params.ledger.genesis->account ().to_account ());
|
||||
tree.put ("amount", nano::dev::genesis_amount.convert_to<std::string> ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1318,7 +1318,7 @@ void nano::node::process_confirmed_data (nano::transaction const & transaction_a
|
|||
bool error (false);
|
||||
auto previous_balance (ledger.balance_safe (transaction_a, previous, error));
|
||||
auto block_balance (store.block.balance_calculated (block_a));
|
||||
if (hash_a != ledger.network_params.ledger.genesis_account ())
|
||||
if (hash_a != ledger.network_params.ledger.genesis->account ())
|
||||
{
|
||||
if (!error)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ nano::node_config::node_config (uint16_t peering_port_a, nano::logging const & l
|
|||
{
|
||||
case nano::networks::nano_dev_network:
|
||||
enable_voting = true;
|
||||
preconfigured_representatives.push_back (network_params.ledger.genesis_account ());
|
||||
preconfigured_representatives.push_back (network_params.ledger.genesis->account ());
|
||||
break;
|
||||
case nano::networks::nano_beta_network:
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ nano::node_config::node_config (uint16_t peering_port_a, nano::logging const & l
|
|||
break;
|
||||
case nano::networks::nano_test_network:
|
||||
preconfigured_peers.push_back (default_test_peer_network);
|
||||
preconfigured_representatives.push_back (network_params.ledger.genesis_account ());
|
||||
preconfigured_representatives.push_back (network_params.ledger.genesis->account ());
|
||||
break;
|
||||
default:
|
||||
debug_assert (false);
|
||||
|
|
|
@ -544,7 +544,7 @@ public:
|
|||
{
|
||||
static nano::network_params params;
|
||||
type = "Receive";
|
||||
if (block_a.hashables.source != params.ledger.genesis_account ())
|
||||
if (block_a.hashables.source != params.ledger.genesis->account ())
|
||||
{
|
||||
bool error_or_pruned (false);
|
||||
account = ledger.account_safe (transaction, block_a.hashables.source, error_or_pruned);
|
||||
|
@ -556,7 +556,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
account = params.ledger.genesis_account ();
|
||||
account = params.ledger.genesis->account ();
|
||||
amount = nano::dev::genesis_amount;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ nano::ledger_constants::ledger_constants (nano::networks network_a) :
|
|||
nano::link epoch_link_v1;
|
||||
const char * epoch_message_v1 ("epoch v1 block");
|
||||
strncpy ((char *)epoch_link_v1.bytes.data (), epoch_message_v1, epoch_link_v1.bytes.size ());
|
||||
epochs.add (nano::epoch::epoch_1, genesis_account (), epoch_link_v1);
|
||||
epochs.add (nano::epoch::epoch_1, genesis->account (), epoch_link_v1);
|
||||
|
||||
nano::link epoch_link_v2;
|
||||
nano::account nano_live_epoch_v2_signer;
|
||||
|
@ -150,13 +150,6 @@ nano::ledger_constants::ledger_constants (nano::networks network_a) :
|
|||
epochs.add (nano::epoch::epoch_2, epoch_v2_signer, epoch_link_v2);
|
||||
}
|
||||
|
||||
nano::account nano::ledger_constants::genesis_account () const
|
||||
{
|
||||
auto result = genesis->account ();
|
||||
debug_assert (!result.is_zero ());
|
||||
return result;
|
||||
}
|
||||
|
||||
nano::random_constants::random_constants ()
|
||||
{
|
||||
nano::random_pool::generate_block (not_an_account.bytes.data (), not_an_account.bytes.size ());
|
||||
|
|
|
@ -368,7 +368,6 @@ class ledger_constants
|
|||
public:
|
||||
ledger_constants (nano::network_constants & network_constants);
|
||||
ledger_constants (nano::networks network_a);
|
||||
nano::account genesis_account () const;
|
||||
nano::keypair zero_key;
|
||||
nano::account nano_beta_account;
|
||||
nano::account nano_live_account;
|
||||
|
|
|
@ -1102,7 +1102,7 @@ nano::account nano::ledger::account_safe (nano::transaction const & transaction_
|
|||
// Return amount decrease or increase for block
|
||||
nano::uint128_t nano::ledger::amount (nano::transaction const & transaction_a, nano::account const & account_a)
|
||||
{
|
||||
release_assert (account_a == network_params.ledger.genesis_account ());
|
||||
release_assert (account_a == network_params.ledger.genesis->account ());
|
||||
return nano::dev::genesis_amount;
|
||||
}
|
||||
|
||||
|
@ -1204,7 +1204,7 @@ public:
|
|||
}
|
||||
void open_block (nano::open_block const & block_a) override
|
||||
{
|
||||
if (block_a.source () != ledger.network_params.ledger.genesis_account ())
|
||||
if (block_a.source () != ledger.network_params.ledger.genesis->account ())
|
||||
{
|
||||
result[0] = block_a.source ();
|
||||
}
|
||||
|
|
|
@ -110,13 +110,13 @@ public:
|
|||
auto hash_l (network_params.ledger.genesis->hash ());
|
||||
block.put (transaction_a, hash_l, *network_params.ledger.genesis);
|
||||
++ledger_cache_a.block_count;
|
||||
confirmation_height.put (transaction_a, network_params.ledger.genesis_account (), nano::confirmation_height_info{ 1, network_params.ledger.genesis->hash () });
|
||||
confirmation_height.put (transaction_a, network_params.ledger.genesis->account (), nano::confirmation_height_info{ 1, network_params.ledger.genesis->hash () });
|
||||
++ledger_cache_a.cemented_count;
|
||||
ledger_cache_a.final_votes_confirmation_canary = (network_params.ledger.final_votes_canary_account == network_params.ledger.genesis_account () && 1 >= network_params.ledger.final_votes_canary_height);
|
||||
account.put (transaction_a, network_params.ledger.genesis_account (), { hash_l, network_params.ledger.genesis_account (), network_params.ledger.genesis->hash (), std::numeric_limits<nano::uint128_t>::max (), nano::seconds_since_epoch (), 1, nano::epoch::epoch_0 });
|
||||
ledger_cache_a.final_votes_confirmation_canary = (network_params.ledger.final_votes_canary_account == network_params.ledger.genesis->account () && 1 >= network_params.ledger.final_votes_canary_height);
|
||||
account.put (transaction_a, network_params.ledger.genesis->account (), { hash_l, network_params.ledger.genesis->account (), network_params.ledger.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 (network_params.ledger.genesis_account (), std::numeric_limits<nano::uint128_t>::max ());
|
||||
frontier.put (transaction_a, hash_l, network_params.ledger.genesis_account ());
|
||||
ledger_cache_a.rep_weights.representation_put (network_params.ledger.genesis->account (), std::numeric_limits<nano::uint128_t>::max ());
|
||||
frontier.put (transaction_a, hash_l, network_params.ledger.genesis->account ());
|
||||
}
|
||||
|
||||
bool root_exists (nano::transaction const & transaction_a, nano::root const & root_a) override
|
||||
|
|
|
@ -397,7 +397,7 @@ void nano::system::generate_receive (nano::node & node_a)
|
|||
}
|
||||
if (send_block != nullptr)
|
||||
{
|
||||
auto receive_error (wallet (0)->receive_sync (send_block, nano::ledger_constants (nano::networks::nano_dev_network).genesis_account (), std::numeric_limits<nano::uint128_t>::max ()));
|
||||
auto receive_error (wallet (0)->receive_sync (send_block, nano::dev::genesis->account (), std::numeric_limits<nano::uint128_t>::max ()));
|
||||
(void)receive_error;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue