Fix messageId hash to exclude signature, matching Python/Rust
PlatformIO Build / build (push) Failing after 7m56s
PlatformIO Build / release (push) Has been skipped

messageId was computed as SHA256(dest+src+sig+payload) but Python/Rust
compute SHA256(dest+src+payload) — skipping the 64-byte signature.
This caused message ID mismatches across implementations, breaking
deduplication and propagation node lookups.
This commit is contained in:
DeFiDude
2026-03-17 18:11:35 -06:00
parent d89b6699ab
commit 2c161238c7
+8 -2
View File
@@ -155,8 +155,14 @@ bool LXMFMessage::unpackFull(const uint8_t* data, size_t len, LXMFMessage& msg)
if (!mpReadString(content, contentLen, pos, msg.content)) return false;
if (arrLen >= 4 && pos < contentLen) { mpSkipValue(content, contentLen, pos); }
RNS::Bytes fullPayload(data, len);
msg.messageId = RNS::Identity::full_hash(fullPayload);
// messageId = SHA256(dest + src + packed_content), matching Python/Rust
// (skip signature at bytes 32..96)
std::vector<uint8_t> hashInput;
hashInput.reserve(32 + (len - 96));
hashInput.insert(hashInput.end(), data, data + 32); // dest_hash + src_hash
hashInput.insert(hashInput.end(), data + 96, data + len); // packed_content
RNS::Bytes hashable(hashInput.data(), hashInput.size());
msg.messageId = RNS::Identity::full_hash(hashable);
msg.incoming = true;
msg.status = LXMFStatus::DELIVERED;
return true;