Skip to content

Commit bbfddde

Browse files
committed
fix: update presign selection to use int32 for hash index calculation
1 parent ed52f34 commit bbfddde

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

pkg/mpc/taurus/cggmp21.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,9 @@ func (p *CGGMP21Session) selectAndLoadPresign() (*ecdsa.PreSignature, string) {
326326
return filtered[i].CreatedAt.Before(filtered[j].CreatedAt)
327327
})
328328
h := sha256.Sum256([]byte(p.sessionID))
329-
v := binary.BigEndian.Uint64(h[:8])
330-
n := uint64(len(filtered))
331-
idx := v % n
332-
chosen := filtered[int(idx)]
329+
hashVal := int64(binary.BigEndian.Uint32(h[:4]))
330+
idx := int(hashVal % int64(len(filtered)))
331+
chosen := filtered[idx]
333332

334333
// Load presign from KV
335334
key := p.composePresignKey(p.sessionID, chosen.TxID)

0 commit comments

Comments
 (0)