From 9047ab7ea594cd3aecc20bdb486e9f605d3ee138 Mon Sep 17 00:00:00 2001 From: Geovane Fedrecheski Date: Tue, 16 Jun 2026 15:43:02 +0200 Subject: [PATCH] packet: only copy bloom filter into beacon when available The bloom filter is recomputed in the gateway main loop while beacons are built in the radio slot ISR. Copying mid-recompute puts a partial bloom on the air, and a joined node that fails the membership test on such a beacon leaves with MARI_PEER_LOST_BLOOM. Gate the copy on availability so a beacon is not populated from a filter that is mid-recompute. AI-assisted: Claude Opus 4.8 --- firmware/mari/packet.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/firmware/mari/packet.c b/firmware/mari/packet.c index 0b13b6f..8af9e61 100644 --- a/firmware/mari/packet.c +++ b/firmware/mari/packet.c @@ -55,8 +55,10 @@ size_t mr_build_packet_beacon(uint8_t *buffer, uint16_t net_id, uint64_t asn, ui .remaining_capacity = remaining_capacity, .active_schedule_id = active_schedule_id, }; - // add bloom filter - mr_bloom_gateway_copy(beacon.bloom_filter); + // add bloom filter, if available + if (mr_bloom_gateway_is_available()) { + mr_bloom_gateway_copy(beacon.bloom_filter); + } memcpy(buffer, &beacon, sizeof(mr_beacon_packet_header_t)); return sizeof(mr_beacon_packet_header_t); }