mirror of
https://github.com/luxfi/threshold.git
synced 2026-10-30 15:15:53 +00:00
VerifyMessage/StoreMessage/MessageContent/Number/BroadcastContent on round structs were value receivers. Go FAQ: "if any method on T takes *T, all methods should take *T." Finalize already takes *T (it mutates round state) so the others should too. Aligns the method set, removes silent struct-copies on every dispatch, and prevents future drift where a value-receiver method accidentally observes pre-Finalize state. No behavior change — all current methods are no-ops or return constants. Touched: round.Abort, round.Output, all CMP keygen/presign/sign rounds, all Doerner keygen/sign rounds, all FROST keygen/sign rounds, xor example. Build + vet clean; CMP/FROST/Doerner -race tests PASS.
42 lines
955 B
Go
42 lines
955 B
Go
package keygen
|
|
|
|
import (
|
|
"github.com/luxfi/threshold/internal/ot"
|
|
"github.com/luxfi/threshold/internal/round"
|
|
)
|
|
|
|
// round3S is the third round from the Sender's perspective.
|
|
type round3S struct {
|
|
*round2S
|
|
setup *ot.CorreOTSendSetup
|
|
}
|
|
|
|
func (r *round3S) VerifyMessage(msg round.Message) error {
|
|
body, ok := msg.Content.(*message3R)
|
|
if !ok || body == nil {
|
|
return round.ErrInvalidContent
|
|
}
|
|
if body.OtMsg == nil {
|
|
return round.ErrNilFields
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (r *round3S) StoreMessage(msg round.Message) (err error) {
|
|
body := msg.Content.(*message3R)
|
|
r.setup, err = r.sender.Round3(body.OtMsg)
|
|
return
|
|
}
|
|
|
|
func (r *round3S) Finalize(out chan<- *round.Message) (round.Session, error) {
|
|
return r.ResultRound(&ConfigSender{Setup: r.setup, SecretShare: r.secretShare, Public: r.public, ChainKey: r.chainKey}), nil
|
|
}
|
|
|
|
func (r *round3S) MessageContent() round.Content {
|
|
return &message3R{}
|
|
}
|
|
|
|
func (*round3S) Number() round.Number {
|
|
return 3
|
|
}
|