Skip to content

Commit

Permalink
Some comments documenting pending_key and pending_info classes
Browse files Browse the repository at this point in the history
  • Loading branch information
dsiganos committed Apr 12, 2024
1 parent 92b4455 commit ded54b2
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions nano/secure/pending_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace nano
{
/**
* Information on an uncollected send
* This class captures the data stored in a pending table entry
*/
class pending_info final
{
Expand All @@ -27,9 +28,9 @@ class pending_info final
size_t db_size () const;
bool deserialize (nano::stream &);
bool operator== (nano::pending_info const &) const;
nano::account source{};
nano::amount amount{ 0 };
nano::epoch epoch{ nano::epoch::epoch_0 };
nano::account source{}; // the account sending the funds
nano::amount amount{ 0 }; // amount receivable in this transaction
nano::epoch epoch{ nano::epoch::epoch_0 }; // epoch of sending block, this info is stored here to make it possible to prune the send block

friend std::ostream & operator<< (std::ostream & os, const nano::pending_info & info)
{
Expand All @@ -38,6 +39,9 @@ class pending_info final
return os;
}
};

// This class represents the data written into the pending (receivable) database table key
// the receiving account and hash of the send block identify a pending db table entry
class pending_key final
{
public:
Expand All @@ -47,15 +51,16 @@ class pending_key final
bool operator== (nano::pending_key const &) const;
bool operator< (nano::pending_key const &) const;
nano::account const & key () const;
nano::account account{};
nano::block_hash hash{ 0 };
nano::account account{}; // receiving account
nano::block_hash hash{ 0 }; // hash of the send block

friend std::ostream & operator<< (std::ostream & os, const nano::pending_key & key)
{
os << "Account: " << key.account << ", Hash: " << key.hash;
return os;
}
};

// This class iterates receivable enttries for an account
class receivable_iterator
{
Expand Down

0 comments on commit ded54b2

Please sign in to comment.