Skip to content

Latest commit

 

History

History
80 lines (60 loc) · 1.61 KB

protocol.h.adoc

File metadata and controls

80 lines (60 loc) · 1.61 KB

比特币源码分析

1. 山寨开发关注度:五星

基本上每个客户都会要求修改钱包地址首字母

2. 全局函数

方法名 说明

static inline unsigned short GetDefaultPort(const bool testnet = fTestNet)

3. CMessageHeader类

base58编码数据的基类

3.1. 成员变量

  • pchMessageStart[MESSAGE_START_SIZE]; (4) message start.

  • pchCommand[COMMAND_SIZE]; (12) command.

  • nMessageSize; (4) size.

  • nChecksum; (4) checksum.

3.2. 成员函数

方法名 说明

CMessageHeader();

CMessageHeader(const char* pszCommand, unsigned int nMessageSizeIn);

std::string GetCommand() const;

bool IsValid() const;

4. CAddress类

CService 附带作为peer的相关信息

4.1. 成员变量

  • nServices;

  • unsigned int nTime;//disk and network only

  • int64 nLastTry;// memory only

4.2. 成员函数

方法名 说明

CAddress();

…​

explicit CAddress(CService ipIn, uint64 nServicesIn=NODE_NETWORK);

…​

void Init();

…​

void print() const;

…​

5. CInv类

inv message data

5.1. 成员变量

  • int type;

  • uint256 hash;

5.2. 成员函数

方法名 说明

bool IsKnownType() const;

const char* GetCommand() const;

std::string ToString() const;

void print() const;