mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 20:32:35 -03:00
net: Hardcode protocol sizes and use fixed-size types
The P2P network uses a fixed protocol, these sizes shouldn't change based on what happens to be the architecture.
This commit is contained in:
parent
41e58faf04
commit
305087bdf6
1 changed files with 3 additions and 3 deletions
|
@ -52,8 +52,8 @@ public:
|
||||||
public:
|
public:
|
||||||
enum {
|
enum {
|
||||||
COMMAND_SIZE = 12,
|
COMMAND_SIZE = 12,
|
||||||
MESSAGE_SIZE_SIZE = sizeof(int),
|
MESSAGE_SIZE_SIZE = 4,
|
||||||
CHECKSUM_SIZE = sizeof(int),
|
CHECKSUM_SIZE = 4,
|
||||||
|
|
||||||
MESSAGE_SIZE_OFFSET = MESSAGE_START_SIZE + COMMAND_SIZE,
|
MESSAGE_SIZE_OFFSET = MESSAGE_START_SIZE + COMMAND_SIZE,
|
||||||
CHECKSUM_OFFSET = MESSAGE_SIZE_OFFSET + MESSAGE_SIZE_SIZE,
|
CHECKSUM_OFFSET = MESSAGE_SIZE_OFFSET + MESSAGE_SIZE_SIZE,
|
||||||
|
@ -61,7 +61,7 @@ public:
|
||||||
};
|
};
|
||||||
char pchMessageStart[MESSAGE_START_SIZE];
|
char pchMessageStart[MESSAGE_START_SIZE];
|
||||||
char pchCommand[COMMAND_SIZE];
|
char pchCommand[COMMAND_SIZE];
|
||||||
unsigned int nMessageSize;
|
uint32_t nMessageSize;
|
||||||
uint8_t pchChecksum[CHECKSUM_SIZE];
|
uint8_t pchChecksum[CHECKSUM_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue