Remove Session from VariantSignId::SlashReport

It's only there to make the VariantSignid unique across Sessions. By localizing
the VariantSignid to a Session, we avoid this, and can better ensure we don't
queue work for historic sessions.
This commit is contained in:
Luke Parker
2024-12-30 06:16:03 -05:00
parent 445c49f030
commit 1de8136739
5 changed files with 38 additions and 20 deletions

View File

@@ -79,8 +79,7 @@ impl<D: Db, S: ScannerFeed> ContinuallyRan for SlashReportSignerTask<D, S> {
}
}
let mut txn = self.db.txn();
for msg in self.attempt_manager.register(VariantSignId::SlashReport(self.session), machines)
{
for msg in self.attempt_manager.register(VariantSignId::SlashReport, machines) {
SlashReportSignerToCoordinatorMessages::send(&mut txn, self.session, &msg);
}
txn.commit();
@@ -102,14 +101,15 @@ impl<D: Db, S: ScannerFeed> ContinuallyRan for SlashReportSignerTask<D, S> {
}
}
Response::Signature { id, signature } => {
let VariantSignId::SlashReport(session) = id else {
panic!("SlashReportSignerTask signed a non-SlashReport")
};
assert_eq!(session, self.session);
assert_eq!(id, VariantSignId::SlashReport);
// Drain the channel
SlashReport::try_recv(&mut txn, self.session).unwrap();
// Send the signature
SlashReportSignature::send(&mut txn, session, &Signature::from(signature).encode());
SlashReportSignature::send(
&mut txn,
self.session,
&Signature::from(signature).encode(),
);
}
}