diff --git a/src/currency_core/currency_format_utils.h b/src/currency_core/currency_format_utils.h index c6c5d0bf..317b99dd 100644 --- a/src/currency_core/currency_format_utils.h +++ b/src/currency_core/currency_format_utils.h @@ -43,6 +43,30 @@ //------ +bool parse_hash256(const std::string str_hash, crypto::hash& hash); +template +std::ostream &print256(std::ostream &o, const T &v) { + return o << "<" << epee::string_tools::pod_to_hex(v) << ">"; +} + +template +std::ostream &print16(std::ostream &o, const T &v) { + return o << "<" << epee::string_tools::pod_to_hex(v).substr(0, 5) << "..>"; +} + +template +std::string print16(const T &v) { + return std::string("<") + epee::string_tools::pod_to_hex(v).substr(0, 5) + "..>"; +} + +namespace crypto { + inline std::ostream &operator <<(std::ostream &o, const crypto::public_key &v) { return print256(o, v); } + inline std::ostream &operator <<(std::ostream &o, const crypto::secret_key &v) { return print256(o, v); } + inline std::ostream &operator <<(std::ostream &o, const crypto::key_derivation &v) { return print256(o, v); } + inline std::ostream &operator <<(std::ostream &o, const crypto::key_image &v) { return print256(o, v); } + inline std::ostream &operator <<(std::ostream &o, const crypto::signature &v) { return print256(o, v); } + inline std::ostream &operator <<(std::ostream &o, const crypto::hash &v) { return print256(o, v); } +} namespace currency { @@ -852,46 +876,5 @@ namespace currency } // namespace currency -template -std::ostream &print256(std::ostream &o, const T &v) { - return o << "<" << epee::string_tools::pod_to_hex(v) << ">"; -} - -template -std::ostream &print16(std::ostream &o, const T &v) { - return o << "<" << epee::string_tools::pod_to_hex(v).substr(0, 5) << "..>"; -} - -template -std::string print16(const T &v) { - return std::string("<") + epee::string_tools::pod_to_hex(v).substr(0, 5) + "..>"; -} -//POD_MAKE_COMPARABLE(currency, extra_attachment_info) - - -// namespace std -// { -// inline -// bool operator ==(const currency::transaction& a, const currency::transaction& b) -// { -// return currency::get_transaction_hash(a) == currency::get_transaction_hash(b); -// } -// inline -// bool operator ==(const currency::block& a, const currency::block& b) -// { -// return currency::get_block_hash(a) == currency::get_block_hash(b); -// } -// } - -bool parse_hash256(const std::string str_hash, crypto::hash& hash); - -namespace crypto { - inline std::ostream &operator <<(std::ostream &o, const crypto::public_key &v) { return print256(o, v); } - inline std::ostream &operator <<(std::ostream &o, const crypto::secret_key &v) { return print256(o, v); } - inline std::ostream &operator <<(std::ostream &o, const crypto::key_derivation &v) { return print256(o, v); } - inline std::ostream &operator <<(std::ostream &o, const crypto::key_image &v) { return print256(o, v); } - inline std::ostream &operator <<(std::ostream &o, const crypto::signature &v) { return print256(o, v); } - inline std::ostream &operator <<(std::ostream &o, const crypto::hash &v) { return print256(o, v); } -} diff --git a/src/currency_protocol/currency_protocol_handler.inl b/src/currency_protocol/currency_protocol_handler.inl index f449fc52..040e73f6 100644 --- a/src/currency_protocol/currency_protocol_handler.inl +++ b/src/currency_protocol/currency_protocol_handler.inl @@ -102,7 +102,7 @@ namespace currency << std::setw(25) << std::to_string(cntxt.m_recv_cnt)+ "(" + std::to_string(time(NULL) - cntxt.m_last_recv) + ")" + "/" + std::to_string(cntxt.m_send_cnt) + "(" + std::to_string(time(NULL) - cntxt.m_last_send) + ")" << std::setw(25) << get_protocol_state_string(cntxt.m_state) << std::setw(20) << std::to_string(time(NULL) - cntxt.m_started) - << std::setw(20) << cntxt.m_priv.m_remote_version + << std::setw(20) << cntxt.m_remote_version << ENDL; return true; }); diff --git a/tests/core_tests/checkpoints_tests.cpp b/tests/core_tests/checkpoints_tests.cpp index 80faac39..9179efb8 100644 --- a/tests/core_tests/checkpoints_tests.cpp +++ b/tests/core_tests/checkpoints_tests.cpp @@ -628,7 +628,7 @@ bool gen_no_attchments_in_coinbase::init_config_set_cp(currency::core& c, size_t crc.pos_minimum_heigh = 1; c.get_blockchain_storage().set_core_runtime_config(crc); - m_checkpoints.add_checkpoint(12, "57ba6f8b5de551d361d6c56f42ebf3ce1e0b21e42d1499dc9bd2b69c09357062");//"6cac77f011a1d16c7c64fc16403670b71dbad38268e9bfc94d1c08c349ea19c5"); + m_checkpoints.add_checkpoint(12, "d34f992c250cad590b474bf0096273fb9beb0d5540a258b46bbbe6e99632fc1a"); c.set_checkpoints(currency::checkpoints(m_checkpoints)); return true;