Changeset View
Changeset View
Standalone View
Standalone View
src/test/fuzz/process_message.cpp
Show First 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | CNode p2p_node{0, | ||||
std::string{}, | std::string{}, | ||||
false}; | false}; | ||||
p2p_node.fSuccessfullyConnected = true; | p2p_node.fSuccessfullyConnected = true; | ||||
p2p_node.nVersion = PROTOCOL_VERSION; | p2p_node.nVersion = PROTOCOL_VERSION; | ||||
p2p_node.SetSendVersion(PROTOCOL_VERSION); | p2p_node.SetSendVersion(PROTOCOL_VERSION); | ||||
g_setup->m_node.peer_logic->InitializeNode(config, &p2p_node); | g_setup->m_node.peer_logic->InitializeNode(config, &p2p_node); | ||||
try { | try { | ||||
(void)ProcessMessage( | (void)ProcessMessage( | ||||
config, &p2p_node, random_message_type, random_bytes_data_stream, | config, p2p_node, random_message_type, random_bytes_data_stream, | ||||
GetTimeMillis(), g_setup->m_node.connman.get(), | GetTimeMillis(), g_setup->m_node.connman.get(), | ||||
g_setup->m_node.banman.get(), std::atomic<bool>{false}); | g_setup->m_node.banman.get(), std::atomic<bool>{false}); | ||||
} catch (const std::ios_base::failure &e) { | } catch (const std::ios_base::failure &e) { | ||||
const std::string exception_message{e.what()}; | const std::string exception_message{e.what()}; | ||||
const auto p = | const auto p = | ||||
EXPECTED_DESERIALIZATION_EXCEPTIONS.find(exception_message); | EXPECTED_DESERIALIZATION_EXCEPTIONS.find(exception_message); | ||||
if (p == EXPECTED_DESERIALIZATION_EXCEPTIONS.cend() || | if (p == EXPECTED_DESERIALIZATION_EXCEPTIONS.cend() || | ||||
p->second.count(random_message_type) == 0) { | p->second.count(random_message_type) == 0) { | ||||
std::cout << "Unexpected exception when processing message type \"" | std::cout << "Unexpected exception when processing message type \"" | ||||
<< random_message_type << "\": " << exception_message | << random_message_type << "\": " << exception_message | ||||
<< std::endl; | << std::endl; | ||||
assert(false); | assert(false); | ||||
} | } | ||||
} | } | ||||
SyncWithValidationInterfaceQueue(); | SyncWithValidationInterfaceQueue(); | ||||
} | } |