aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/signatures.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm/signatures.rs')
-rw-r--r--src/swarm/signatures.rs51
1 files changed, 23 insertions, 28 deletions
diff --git a/src/swarm/signatures.rs b/src/swarm/signatures.rs
index 9ea404e..111b3da 100644
--- a/src/swarm/signatures.rs
+++ b/src/swarm/signatures.rs
@@ -75,35 +75,30 @@ pub(crate) async fn received(state: &AppState, message: SignaturesMessage) {
if replica.epoch != message.epoch {
return 0;
}
- {
- let (epoch, epoch_seq) = (replica.epoch, replica.epoch_seq);
- let replica = &mut *replica;
- replica.signatures.offer(&replica.doc, signatures);
- // With signatures required, changes waiting for them judged again
- // (`access::screen`).
- if crate::access::policy::of(&replica.doc).required() {
- let applied = replica.logged_signed(|doc, known, log| {
- let applied = crate::access::screen::apply_bytes(
- doc,
- epoch,
- epoch_seq,
- &[],
- &screening,
- Some(known),
- log,
- );
- (applied, true)
- });
- replica.refresh_heads();
- return match applied {
- Ok(outcome) => outcome.applied,
- Err(error) => {
- tracing::warn!(error = %format!("{error:#}"), "Couldn't judge the changes waiting for signatures");
- 0
- }
- };
+ let (epoch, epoch_seq) = (replica.epoch, replica.epoch_seq);
+ let replica = &mut *replica;
+ replica.signatures.offer(&replica.doc, signatures);
+ // Changes waiting for them judged again (`access::screen`): those the policy they
+ // were written under requires signed.
+ let applied = replica.logged_signed(|doc, known, log| {
+ let applied = crate::access::screen::apply_bytes(
+ doc,
+ epoch,
+ epoch_seq,
+ &[],
+ &screening,
+ Some(known),
+ log,
+ );
+ (applied, true)
+ });
+ replica.refresh_heads();
+ match applied {
+ Ok(outcome) => outcome.applied,
+ Err(error) => {
+ tracing::warn!(error = %format!("{error:#}"), "Couldn't judge the changes waiting for signatures");
+ 0
}
- 0
}
})
.await