diff options
| author | tv <tv@krebsco.de> | 2026-11-08 21:47:21 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-08 22:58:44 +0100 |
| commit | 46978f2b6b102750bcc8eef3b0b286b6008240f7 (patch) | |
| tree | 2fdd596b176e9790ccd37ddf2deee804105b54e3 /src/document/signatures.rs | |
| parent | 1fa5360a210b4b820441fdbc6f5dfbbb9eaf14f3 (diff) | |
signatures: tell held changes as the screen does
With every message's signatures offered now (1205), Signatures::offer
runs for each, and it asked get_change_meta_by_hash whether the
document holds each signature's change, and each one waiting, up to
4096 of them: Automerge rebuilds the change's metadata from the
document's operations to answer. Ask changes::holds instead (1197),
there and in forks and kept_for; the metadata is still read where it
is used.
Diffstat (limited to 'src/document/signatures.rs')
| -rw-r--r-- | src/document/signatures.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/document/signatures.rs b/src/document/signatures.rs index 27bbb9e..2f408d5 100644 --- a/src/document/signatures.rs +++ b/src/document/signatures.rs @@ -295,7 +295,7 @@ impl Signatures { let kept = self .order .iter() - .filter(|hash| doc.get_change_meta_by_hash(hash).is_some()) + .filter(|hash| super::changes::holds(doc, hash)) .map(|hash| (*hash, self.by_change[hash])) .collect(); Self { @@ -353,7 +353,7 @@ impl Signatures { pub(crate) fn offer(&mut self, doc: &Document, received: Vec<(ChangeHash, [u8; 64])>) -> usize { let mut kept = 0; for (hash, signature) in received { - if doc.get_change_meta_by_hash(&hash).is_none() { + if !super::changes::holds(doc, &hash) { self.pending.insert(hash, signature); } else if self.vouch(doc, hash, &signature) { self.insert(hash, signature); @@ -363,7 +363,7 @@ impl Signatures { let arrived: Vec<ChangeHash> = self .pending .keys() - .filter(|hash| doc.get_change_meta_by_hash(hash).is_some()) + .filter(|hash| super::changes::holds(doc, hash)) .copied() .collect(); for hash in arrived { @@ -455,7 +455,7 @@ impl Signatures { /// sign one. pub(crate) fn forks(&self, doc: &Document, change: &super::Change) -> bool { self.latest.get(change.actor_id()).is_some_and(|latest| { - latest.seq >= change.seq() && doc.get_change_meta_by_hash(&latest.hash).is_some() + latest.seq >= change.seq() && super::changes::holds(doc, &latest.hash) }) } |
