aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/bootstrap.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-07 22:35:21 +0100
committertv <tv@krebsco.de>2026-11-07 22:35:21 +0100
commit63b34dfa41e1595145507a88901e332bf4bd3b14 (patch)
treee33955ead52d4155a2c5cb5b1abaa3cb7e83f8a6 /src/swarm/bootstrap.rs
parentc9b05d33f57b7efd69301b56725614a0d9938599 (diff)
signatures: kept in the document file
A node's signatures are saved with its document (--document-file) and loaded with it. Auth plan M5.
Diffstat (limited to 'src/swarm/bootstrap.rs')
-rw-r--r--src/swarm/bootstrap.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/swarm/bootstrap.rs b/src/swarm/bootstrap.rs
index 446b846..10ad412 100644
--- a/src/swarm/bootstrap.rs
+++ b/src/swarm/bootstrap.rs
@@ -241,6 +241,8 @@ pub(crate) struct StartingDocument {
pub(crate) origin: Origin,
/// The actors this node wrote with before (from the document file).
pub(crate) earlier_actors: Vec<ActorId>,
+ /// The signatures of its changes (from the document file).
+ pub(crate) signatures: Vec<(crate::document::ChangeHash, [u8; 64])>,
}
/// What `--recover-from` and `--document-file` say about where to start.
@@ -289,7 +291,7 @@ pub(crate) fn starting_document(
Some(path) => Some(load_backup(path, files)?),
};
- let (doc, origin, earlier_actors) = match (backup, from_file) {
+ let (doc, origin, earlier_actors, signatures) = match (backup, from_file) {
(Some(_), Some(_)) if !force.allows("replaceDocumentFile") => {
bail!(
"recover-from would replace the document in the document file; add --force replaceDocumentFile to recover the backup anyway"
@@ -301,9 +303,14 @@ pub(crate) fn starting_document(
"Recovering the backup instead of the document file's document (--force replaceDocumentFile)"
);
}
- (backup, Origin::Backup, Vec::new())
+ (backup, Origin::Backup, Vec::new(), Vec::new())
}
- (None, Some(loaded)) => (loaded.doc, Origin::DocumentFile, loaded.actors),
+ (None, Some(loaded)) => (
+ loaded.doc,
+ Origin::DocumentFile,
+ loaded.actors,
+ loaded.signatures,
+ ),
(None, None) => return Ok(None),
};
if options.genesis && origin == Origin::DocumentFile {
@@ -311,7 +318,8 @@ pub(crate) fn starting_document(
"The document file holds a document of a swarm, and genesis would start a new one; move the file away to start a new swarm"
);
}
- let starting = identify(doc, origin, earlier_actors)?;
+ let mut starting = identify(doc, origin, earlier_actors)?;
+ starting.signatures = signatures;
if let Some(remembered) = options.remembered.filter(|id| *id != starting.swarm_id) {
let what = origin.describe();
@@ -347,6 +355,7 @@ fn identify(
swarm_id,
origin,
earlier_actors,
+ signatures: Vec::new(),
})
}