hello and ack exchange

This commit is contained in:
2026-04-25 20:28:38 +02:00
parent 32b9a57366
commit bd972bfab6
6 changed files with 236 additions and 92 deletions

View File

@@ -6,13 +6,15 @@
typedef enum {
PACKET_TYPE_NONE = 0,
PACKET_TYPE_HELLO = 1, // Hello, let's connect! Here's who I am, and what I have!
PACKET_TYPE_FETCH_BLOCK = 2, // I want a Block
PACKET_TYPE_BLOCK_DATA = 3, // Here's a Block (response to fetch) - I don't care what you do with it, but you wanted it, so here it is!
PACKET_TYPE_BROADCAST_BLOCK = 4, // Here's a new Block I want to share with the network (unsolicited - e.g. just mined it)
PACKET_TYPE_ACK_BLOCK = 5, // I have received your block, here's what I did with it (response to broadcast)
PACKET_TYPE_BROADCAST_TX = 6, // Here's a new transaction I want to share with the network
PACKET_TYPE_ACK_TX = 7, // I have received your transaction, here's what I did with it (response to broadcast)
PACKET_TYPE_MAX = 9
PACKET_TYPE_ACK_HELLO = 2, // I received your hello, here's who I am and what I have (response to hello)
PACKET_TYPE_FETCH_BLOCK = 3, // I want a Block
PACKET_TYPE_BLOCK_DATA = 4, // Here's a Block (response to fetch) - I don't care what you do with it, but you wanted it, so here it is!
PACKET_TYPE_BROADCAST_BLOCK = 5, // Here's a new Block I want to share with the network (unsolicited - e.g. just mined it)
PACKET_TYPE_ACK_BLOCK = 6, // I have received your block, here's what I did with it (response to broadcast)
PACKET_TYPE_BROADCAST_TX = 7, // Here's a new transaction I want to share with the network
PACKET_TYPE_ACK_TX = 8, // I have received your transaction, here's what I did with it (response to broadcast)
PACKET_TYPE_ERROR = 9, // Something went wrong with the packet you sent me, here's an error message (can be response to any packet)
PACKET_TYPE_MAX = 10
} packet_type_t;
static inline int PacketType_IsValid(uint8_t packetType) {