Skip to content

Commit

Permalink
ID TRACKING
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Jan 22, 2024
1 parent 9afe51d commit eea5def
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
7 changes: 7 additions & 0 deletions nano/lib/id_dispenser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,11 @@ inline id_dispenser & id_gen ()
static id_dispenser id_gen;
return id_gen;
}

using id_t = id_dispenser::id_t;

inline id_t next_id ()
{
return id_gen ().next_id ();
}
}
1 change: 0 additions & 1 deletion nano/node/election.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ nano::election_vote_result::election_vote_result (bool replay_a, bool processed_
*/

nano::election::election (nano::node & node_a, std::shared_ptr<nano::block> const & block_a, std::function<void (std::shared_ptr<nano::block> const &)> const & confirmation_action_a, std::function<void (nano::account const &)> const & live_vote_action_a, nano::election_behavior election_behavior_a) :
id{ nano::id_gen ().next_id () },
confirmation_action (confirmation_action_a),
live_vote_action (live_vote_action_a),
node (node_a),
Expand Down
2 changes: 1 addition & 1 deletion nano/node/election.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct election_extended_status final

class election final : public std::enable_shared_from_this<nano::election>
{
nano::id_dispenser::id_t id;
nano::id_t const id{ nano::next_id () }; // Track individual objects when tracing

public:
enum class vote_source
Expand Down
2 changes: 1 addition & 1 deletion nano/store/lmdb/lmdb_env.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ class env final
store::write_transaction tx_begin_write (txn_callbacks callbacks = txn_callbacks{}) const;
MDB_txn * tx (store::transaction const & transaction_a) const;
MDB_env * environment;
nano::id_dispenser::id_t const store_id{ nano::id_gen ().next_id () };
nano::id_t const store_id{ nano::next_id () };
};
} // namespace nano::store::lmdb

0 comments on commit eea5def

Please sign in to comment.