Skip to content

Commit b5aa3f0

Browse files
committed
fix snapshot: Serve known decryption Keys from the DB
If a epoch decryption key is already in the snapshot database send it to Snapshot immediately.
1 parent 0d71005 commit b5aa3f0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

rolling-shutter/snapshot/snapshot.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,14 @@ func (snp *Snapshot) handleDecryptionKeyRequest(ctx context.Context, epochID []b
131131
if err != nil {
132132
return err
133133
}
134+
// First check if the key is already in the database.
135+
decryptionKey, err := snp.db.GetDecryptionKey(ctx, epochID)
136+
if err == nil {
137+
err = snp.hubapi.SubmitProposalKey(epochID, decryptionKey.Key)
138+
return err
139+
} else if err != nil && err != pgx.ErrNoRows {
140+
return err
141+
}
134142
trigMsg, err := p2pmsg.NewSignedDecryptionTrigger(
135143
snp.Config.InstanceID,
136144
convEpoch,

0 commit comments

Comments
 (0)