adding confirm_req to_string() (#3984)
Adding a to_string function to confirm_req class. Co-authored-by: Dimitrios Siganos <dimitris@siganos.org>
This commit is contained in:
parent
a1ff89ba10
commit
980481b0ea
2 changed files with 20 additions and 0 deletions
|
@ -940,6 +940,25 @@ std::size_t nano::confirm_req::size (nano::block_type type_a, std::size_t count)
|
|||
return result;
|
||||
}
|
||||
|
||||
std::string nano::confirm_req::to_string () const
|
||||
{
|
||||
std::string s = header.to_string ();
|
||||
|
||||
if (header.block_type () == nano::block_type::not_a_block)
|
||||
{
|
||||
for (auto && roots_hash : roots_hashes)
|
||||
{
|
||||
s += "\n" + roots_hash.first.to_string () + ":" + roots_hash.second.to_string ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
s += "\n" + block->to_json ();
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
* confirm_ack
|
||||
*/
|
||||
|
|
|
@ -198,6 +198,7 @@ public:
|
|||
std::vector<std::pair<nano::block_hash, nano::root>> roots_hashes;
|
||||
std::string roots_string () const;
|
||||
static std::size_t size (nano::block_type, std::size_t = 0);
|
||||
std::string to_string () const;
|
||||
};
|
||||
|
||||
class confirm_ack final : public message
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue