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:
parent
4408281d20
commit
f46662db90
3 changed files with 96 additions and 2 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue