tx mempool start, hello packet

This commit is contained in:
2026-04-24 17:14:40 +02:00
parent accdeebee8
commit 32b9a57366
12 changed files with 193 additions and 25 deletions

View File

@@ -12,29 +12,12 @@
#include <utils.h>
#include <uint256.h>
typedef struct {
uint8_t bytes[32];
} key32_t;
typedef struct {
uint8_t address[32]; // For now just the SHA-256 of the public key; allows representation in different encodings (base58, bech32, etc) without changing the underlying data structure
uint256_t balance;
// TODO: Additional things
} balance_sheet_entry_t;
static inline uint32_t hash_key32(key32_t k) {
uint32_t hash = 2166136261u;
for (int i = 0; i < 32; i++) {
hash ^= k.bytes[i];
hash *= 16777619;
}
return hash;
}
static inline int eq_key32(key32_t a, key32_t b) {
return memcmp(a.bytes, b.bytes, 32) == 0;
}
KHASH_INIT(balance_sheet_map_m, key32_t, balance_sheet_entry_t, 1, hash_key32, eq_key32)
extern khash_t(balance_sheet_map_m)* sheetMap;