mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Give V1TransportDeserializer CChainParams& member
This adds a CChainParams& member to V1TransportDeserializer member, and use it in place of many Params() calls. In addition to reducing the number of calls to a global, this removes a parameter from GetMessage (and will later allow us to remove one from CMessageHeader::IsValid())
This commit is contained in:
@@ -20,7 +20,7 @@ void initialize()
|
||||
void test_one_input(const std::vector<uint8_t>& buffer)
|
||||
{
|
||||
// Construct deserializer, with a dummy NodeId
|
||||
V1TransportDeserializer deserializer{(NodeId)0, SER_NETWORK, INIT_PROTO_VERSION};
|
||||
V1TransportDeserializer deserializer{Params(), (NodeId)0, SER_NETWORK, INIT_PROTO_VERSION};
|
||||
const char* pch = (const char*)buffer.data();
|
||||
size_t n_bytes = buffer.size();
|
||||
while (n_bytes > 0) {
|
||||
@@ -33,7 +33,7 @@ void test_one_input(const std::vector<uint8_t>& buffer)
|
||||
if (deserializer.Complete()) {
|
||||
const std::chrono::microseconds m_time{std::numeric_limits<int64_t>::max()};
|
||||
uint32_t out_err_raw_size{0};
|
||||
Optional<CNetMessage> result{deserializer.GetMessage(Params().MessageStart(), m_time, out_err_raw_size)};
|
||||
Optional<CNetMessage> result{deserializer.GetMessage(m_time, out_err_raw_size)};
|
||||
if (result) {
|
||||
assert(result->m_command.size() <= CMessageHeader::COMMAND_SIZE);
|
||||
assert(result->m_raw_message_size <= buffer.size());
|
||||
|
||||
Reference in New Issue
Block a user