core: move tx_extra parsing errors to log level 1
They're not fatal, though indicate something wrong
This commit is contained in:
parent
8b0d22a2aa
commit
d6bce4be36
2 changed files with 13 additions and 5 deletions
|
@ -1441,8 +1441,16 @@ POP_WARNINGS
|
||||||
#define CHECK_AND_ASSERT_MES(expr, fail_ret_val, message) do{if(!(expr)) {LOG_ERROR(message); return fail_ret_val;};}while(0)
|
#define CHECK_AND_ASSERT_MES(expr, fail_ret_val, message) do{if(!(expr)) {LOG_ERROR(message); return fail_ret_val;};}while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CHECK_AND_NO_ASSERT_MES_L
|
||||||
|
#define CHECK_AND_NO_ASSERT_MES_L(expr, fail_ret_val, l, message) do{if(!(expr)) {LOG_PRINT_L##l(message); /*LOCAL_ASSERT(expr);*/ return fail_ret_val;};}while(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef CHECK_AND_NO_ASSERT_MES
|
#ifndef CHECK_AND_NO_ASSERT_MES
|
||||||
#define CHECK_AND_NO_ASSERT_MES(expr, fail_ret_val, message) do{if(!(expr)) {LOG_PRINT_L0(message); /*LOCAL_ASSERT(expr);*/ return fail_ret_val;};}while(0)
|
#define CHECK_AND_NO_ASSERT_MES(expr, fail_ret_val, message) CHECK_AND_NO_ASSERT_MES_L(expr, fail_ret_val, 0, message)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CHECK_AND_NO_ASSERT_MES_L1
|
||||||
|
#define CHECK_AND_NO_ASSERT_MES_L1(expr, fail_ret_val, message) CHECK_AND_NO_ASSERT_MES_L(expr, fail_ret_val, 1, message)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -291,14 +291,14 @@ namespace cryptonote
|
||||||
{
|
{
|
||||||
tx_extra_field field;
|
tx_extra_field field;
|
||||||
bool r = ::do_serialize(ar, field);
|
bool r = ::do_serialize(ar, field);
|
||||||
CHECK_AND_NO_ASSERT_MES(r, false, "failed to deserialize extra field. extra = " << string_tools::buff_to_hex_nodelimer(std::string(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size())));
|
CHECK_AND_NO_ASSERT_MES_L1(r, false, "failed to deserialize extra field. extra = " << string_tools::buff_to_hex_nodelimer(std::string(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size())));
|
||||||
tx_extra_fields.push_back(field);
|
tx_extra_fields.push_back(field);
|
||||||
|
|
||||||
std::ios_base::iostate state = iss.rdstate();
|
std::ios_base::iostate state = iss.rdstate();
|
||||||
eof = (EOF == iss.peek());
|
eof = (EOF == iss.peek());
|
||||||
iss.clear(state);
|
iss.clear(state);
|
||||||
}
|
}
|
||||||
CHECK_AND_NO_ASSERT_MES(::serialization::check_stream_state(ar), false, "failed to deserialize extra field. extra = " << string_tools::buff_to_hex_nodelimer(std::string(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size())));
|
CHECK_AND_NO_ASSERT_MES_L1(::serialization::check_stream_state(ar), false, "failed to deserialize extra field. extra = " << string_tools::buff_to_hex_nodelimer(std::string(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size())));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -357,7 +357,7 @@ namespace cryptonote
|
||||||
{
|
{
|
||||||
tx_extra_field field;
|
tx_extra_field field;
|
||||||
bool r = ::do_serialize(ar, field);
|
bool r = ::do_serialize(ar, field);
|
||||||
CHECK_AND_NO_ASSERT_MES(r, false, "failed to deserialize extra field. extra = " << string_tools::buff_to_hex_nodelimer(std::string(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size())));
|
CHECK_AND_NO_ASSERT_MES_L1(r, false, "failed to deserialize extra field. extra = " << string_tools::buff_to_hex_nodelimer(std::string(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size())));
|
||||||
if (field.type() != typeid(tx_extra_nonce))
|
if (field.type() != typeid(tx_extra_nonce))
|
||||||
::do_serialize(newar, field);
|
::do_serialize(newar, field);
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ namespace cryptonote
|
||||||
eof = (EOF == iss.peek());
|
eof = (EOF == iss.peek());
|
||||||
iss.clear(state);
|
iss.clear(state);
|
||||||
}
|
}
|
||||||
CHECK_AND_NO_ASSERT_MES(::serialization::check_stream_state(ar), false, "failed to deserialize extra field. extra = " << string_tools::buff_to_hex_nodelimer(std::string(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size())));
|
CHECK_AND_NO_ASSERT_MES_L1(::serialization::check_stream_state(ar), false, "failed to deserialize extra field. extra = " << string_tools::buff_to_hex_nodelimer(std::string(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size())));
|
||||||
tx_extra.clear();
|
tx_extra.clear();
|
||||||
std::string s = oss.str();
|
std::string s = oss.str();
|
||||||
tx_extra.reserve(s.size());
|
tx_extra.reserve(s.size());
|
||||||
|
|
Loading…
Reference in a new issue