mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
[net] Don't return an optional from TransportDeserializer::GetMessage()
Also, access mapRecvBytesPerMsgCmd with `at()` not `find()`. This throws an error if COMMAND_OTHER doesn't exist, which should never happen. `find()` instead just accessed the last element, which could make debugging more difficult. Resolves review comments from PR19107: - https://github.com/bitcoin/bitcoin/pull/19107#discussion_r478718436 - https://github.com/bitcoin/bitcoin/pull/19107#discussion_r478714497
This commit is contained in:
committed by
John Newbery
parent
e35c4a3d80
commit
8c96008ab1
@@ -309,7 +309,7 @@ public:
|
||||
/** read and deserialize data, advances msg_bytes data pointer */
|
||||
virtual int Read(Span<const uint8_t>& msg_bytes) = 0;
|
||||
// decomposes a message from the context
|
||||
virtual std::optional<CNetMessage> GetMessage(std::chrono::microseconds time, uint32_t& out_err) = 0;
|
||||
virtual CNetMessage GetMessage(std::chrono::microseconds time, bool& reject_message) = 0;
|
||||
virtual ~TransportDeserializer() {}
|
||||
};
|
||||
|
||||
@@ -373,7 +373,7 @@ public:
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
std::optional<CNetMessage> GetMessage(std::chrono::microseconds time, uint32_t& out_err_raw_size) override;
|
||||
CNetMessage GetMessage(std::chrono::microseconds time, bool& reject_message) override;
|
||||
};
|
||||
|
||||
/** The TransportSerializer prepares messages for the network transport
|
||||
|
||||
Reference in New Issue
Block a user