diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2020-06-05 10:22:53 +0300 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2020-09-07 21:03:44 +0300 |
commit | e9a6d8b13b0558b17cdafbd32fd2663b4138ff11 (patch) | |
tree | 2b62861d483b0ed72ff207e24742b6176e860df4 /src/test/fuzz/net.cpp | |
parent | 147d50d63e07f600b414273a9f6b84f9f4ad9696 (diff) | |
download | bitcoin-e9a6d8b13b0558b17cdafbd32fd2663b4138ff11.tar.xz |
p2p: Unify Send and Receive protocol versions
There is no change in behavior on the P2P network.
Diffstat (limited to 'src/test/fuzz/net.cpp')
-rw-r--r-- | src/test/fuzz/net.cpp | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/test/fuzz/net.cpp b/src/test/fuzz/net.cpp index cd0c93b8d0..a85c353243 100644 --- a/src/test/fuzz/net.cpp +++ b/src/test/fuzz/net.cpp @@ -48,7 +48,7 @@ void test_one_input(const std::vector<uint8_t>& buffer) fuzzed_data_provider.ConsumeRandomLengthString(32), fuzzed_data_provider.PickValueInArray({ConnectionType::INBOUND, ConnectionType::OUTBOUND_FULL_RELAY, ConnectionType::MANUAL, ConnectionType::FEELER, ConnectionType::BLOCK_RELAY, ConnectionType::ADDR_FETCH})}; while (fuzzed_data_provider.ConsumeBool()) { - switch (fuzzed_data_provider.ConsumeIntegralInRange<int>(0, 12)) { + switch (fuzzed_data_provider.ConsumeIntegralInRange<int>(0, 11)) { case 0: { node.CloseSocketDisconnect(); break; @@ -58,7 +58,7 @@ void test_one_input(const std::vector<uint8_t>& buffer) break; } case 2: { - node.SetSendVersion(fuzzed_data_provider.ConsumeIntegral<int>()); + node.SetCommonVersion(fuzzed_data_provider.ConsumeIntegral<int>()); break; } case 3: { @@ -71,21 +71,17 @@ void test_one_input(const std::vector<uint8_t>& buffer) break; } case 4: { - node.SetRecvVersion(fuzzed_data_provider.ConsumeIntegral<int>()); - break; - } - case 5: { const CNode* add_ref_node = node.AddRef(); assert(add_ref_node == &node); break; } - case 6: { + case 5: { if (node.GetRefCount() > 0) { node.Release(); } break; } - case 7: { + case 6: { if (node.m_addr_known == nullptr) { break; } @@ -96,7 +92,7 @@ void test_one_input(const std::vector<uint8_t>& buffer) node.AddAddressKnown(*addr_opt); break; } - case 8: { + case 7: { if (node.m_addr_known == nullptr) { break; } @@ -108,7 +104,7 @@ void test_one_input(const std::vector<uint8_t>& buffer) node.PushAddress(*addr_opt, fast_random_context); break; } - case 9: { + case 8: { const std::optional<CInv> inv_opt = ConsumeDeserializable<CInv>(fuzzed_data_provider); if (!inv_opt) { break; @@ -116,11 +112,11 @@ void test_one_input(const std::vector<uint8_t>& buffer) node.AddKnownTx(inv_opt->hash); break; } - case 10: { + case 9: { node.PushTxInventory(ConsumeUInt256(fuzzed_data_provider)); break; } - case 11: { + case 10: { const std::optional<CService> service_opt = ConsumeDeserializable<CService>(fuzzed_data_provider); if (!service_opt) { break; @@ -128,7 +124,7 @@ void test_one_input(const std::vector<uint8_t>& buffer) node.SetAddrLocal(*service_opt); break; } - case 12: { + case 11: { const std::vector<uint8_t> b = ConsumeRandomLengthByteVector(fuzzed_data_provider); bool complete; node.ReceiveMsgBytes((const char*)b.data(), b.size(), complete); @@ -143,10 +139,9 @@ void test_one_input(const std::vector<uint8_t>& buffer) (void)node.GetLocalNonce(); (void)node.GetLocalServices(); (void)node.GetMyStartingHeight(); - (void)node.GetRecvVersion(); const int ref_count = node.GetRefCount(); assert(ref_count >= 0); - (void)node.GetSendVersion(); + (void)node.GetCommonVersion(); (void)node.RelayAddrsWithConn(); const NetPermissionFlags net_permission_flags = fuzzed_data_provider.ConsumeBool() ? |