flash_append(record_buf, sizeof(mudr209_hdr_t)+hdr->payload_sz);
/* Compute CRC over header+payload (excluding CRC field) */ hdr->crc32 = crc32_compute(record_buf, sizeof(mudr209_hdr_t) + len);
if (len > PAYLOAD_MAX) return; // guard assemble_record(payload, len); protect_record(); persist_record(); update_merkle();
static uint8_t record_buf[RECORD_MAX]; static uint32_t record_seq = 0;
build_header(hdr, len); memcpy(data, payload, len);
