gossip: deterministic winner for a concurrently-registered account

Two nodes registering the same name before gossip converges no longer
end up disagreeing. Each account records its home node, and the merge
keeps the earliest registration (by timestamp, then home node), so every
node folds the log to the same owner regardless of delivery order. The
merge is commutative and idempotent.
This commit is contained in:
Jean Chevronnet 2026-07-12 13:11:22 +00:00
parent 4408281d20
commit f46662db90
No known key found for this signature in database
3 changed files with 96 additions and 2 deletions

View file

@ -127,6 +127,16 @@ impl Engine {
self.db.exists(name)
}
#[cfg(test)]
pub(crate) fn test_register_pw(&mut self, name: &str, pw: &str) {
self.db.register(name, pw, None).unwrap();
}
#[cfg(test)]
pub(crate) fn test_account_hash(&self, name: &str) -> Option<String> {
self.db.test_hash(name)
}
#[cfg(test)]
pub(crate) fn test_register_channel(&mut self, name: &str, founder: &str) {
self.db.register_channel(name, founder).unwrap();