mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
fa3da9a6a2
* add in new core methods * clean up * add verification method * add tests * add 1 more test * lint * Update beacon-chain/core/blocks/block_operations.go Co-authored-by: terence tsao <terence@prysmaticlabs.com> * Update beacon-chain/core/blocks/block_operations.go Co-authored-by: terence tsao <terence@prysmaticlabs.com> * Update beacon-chain/core/state/transition.go Co-authored-by: terence tsao <terence@prysmaticlabs.com> * terences review * Update beacon-chain/core/state/transition.go Co-authored-by: terence tsao <terence@prysmaticlabs.com> * fmt Co-authored-by: terence tsao <terence@prysmaticlabs.com>
33 lines
933 B
Go
33 lines
933 B
Go
package bls
|
|
|
|
// SignatureSet refers to the defined set of
|
|
// signatures and its respective public keys and
|
|
// messages required to verify it.
|
|
type SignatureSet struct {
|
|
Signatures []Signature
|
|
PublicKeys []PublicKey
|
|
Messages [][32]byte
|
|
}
|
|
|
|
// NewSet constructs an empty signature set object.
|
|
func NewSet() *SignatureSet {
|
|
return &SignatureSet{
|
|
Signatures: []Signature{},
|
|
PublicKeys: []PublicKey{},
|
|
Messages: [][32]byte{},
|
|
}
|
|
}
|
|
|
|
// Join merges the provided signature set to out current one.
|
|
func (s *SignatureSet) Join(set *SignatureSet) *SignatureSet {
|
|
s.Signatures = append(s.Signatures, set.Signatures...)
|
|
s.PublicKeys = append(s.PublicKeys, set.PublicKeys...)
|
|
s.Messages = append(s.Messages, set.Messages...)
|
|
return s
|
|
}
|
|
|
|
// Verify the current signature set using the batch verify algorithm.
|
|
func (s *SignatureSet) Verify() (bool, error) {
|
|
return VerifyMultipleSignatures(s.Signatures, s.Messages, s.PublicKeys)
|
|
}
|