LCOV - code coverage report
Current view: top level - src - netmessagemaker.h (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 13 13 100.0 %
Date: 2020-10-06 11:46:21 Functions: 42 46 91.3 %
Legend: Modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed

Not modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed
Branches: 0 0 -

           Branch data     Line data    Source code
#       1                 :            : // Copyright (c) 2009-2010 Satoshi Nakamoto
#       2                 :            : // Copyright (c) 2009-2018 The Bitcoin Core developers
#       3                 :            : // Distributed under the MIT software license, see the accompanying
#       4                 :            : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#       5                 :            : 
#       6                 :            : #ifndef BITCOIN_NETMESSAGEMAKER_H
#       7                 :            : #define BITCOIN_NETMESSAGEMAKER_H
#       8                 :            : 
#       9                 :            : #include <net.h>
#      10                 :            : #include <serialize.h>
#      11                 :            : 
#      12                 :            : class CNetMsgMaker
#      13                 :            : {
#      14                 :            : public:
#      15                 :     616709 :     explicit CNetMsgMaker(int nVersionIn) : nVersion(nVersionIn){}
#      16                 :            : 
#      17                 :            :     template <typename... Args>
#      18                 :            :     CSerializedNetMsg Make(int nFlags, std::string msg_type, Args&&... args) const
#      19                 :      91041 :     {
#      20                 :      91041 :         CSerializedNetMsg msg;
#      21                 :      91041 :         if (msg_type == NetMsgType::ADDRv2) {
#      22                 :            :             // Add ADDRV2_FORMAT to the version so that the CNetAddr and CAddress
#      23                 :            :             // serialize methods produce an address in v2 format.
#      24                 :          1 :             nFlags |= ADDRV2_FORMAT;
#      25                 :          1 :         }
#      26                 :      91041 :         msg.m_type = std::move(msg_type);
#      27                 :      91041 :         CVectorWriter{ SER_NETWORK, nFlags | nVersion, msg.data, 0, std::forward<Args>(args)... };
#      28                 :      91041 :         return msg;
#      29                 :      91041 :     }
#      30                 :            : 
#      31                 :            :     template <typename... Args>
#      32                 :            :     CSerializedNetMsg Make(std::string msg_type, Args&&... args) const
#      33                 :      69379 :     {
#      34                 :      69379 :         return Make(0, std::move(msg_type), std::forward<Args>(args)...);
#      35                 :      69379 :     }
#      36                 :            : 
#      37                 :            : private:
#      38                 :            :     const int nVersion;
#      39                 :            : };
#      40                 :            : 
#      41                 :            : #endif // BITCOIN_NETMESSAGEMAKER_H

Generated by: LCOV version 1.14