diff --git a/nano/node/messages.cpp b/nano/node/messages.cpp index a02f943a..c1d77957 100644 --- a/nano/node/messages.cpp +++ b/nano/node/messages.cpp @@ -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 */ diff --git a/nano/node/messages.hpp b/nano/node/messages.hpp index 3395fc5b..fb236803 100644 --- a/nano/node/messages.hpp +++ b/nano/node/messages.hpp @@ -198,6 +198,7 @@ public: std::vector> 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