mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 23:25:22 +00:00
consensus: check if payload is present in cache before validation
Don't check signature correctness twice.
This commit is contained in:
parent
b92a1e3480
commit
f67b8ce607
1 changed files with 4 additions and 4 deletions
|
@ -256,12 +256,12 @@ func (s *service) getKeyPair(pubs []crypto.PublicKey) (int, crypto.PrivateKey, c
|
|||
// OnPayload handles Payload receive.
|
||||
func (s *service) OnPayload(cp *Payload) {
|
||||
log := s.log.With(zap.Stringer("hash", cp.Hash()))
|
||||
if !s.validatePayload(cp) {
|
||||
log.Debug("can't validate payload")
|
||||
return
|
||||
} else if s.cache.Has(cp.Hash()) {
|
||||
if s.cache.Has(cp.Hash()) {
|
||||
log.Debug("payload is already in cache")
|
||||
return
|
||||
} else if !s.validatePayload(cp) {
|
||||
log.Debug("can't validate payload")
|
||||
return
|
||||
}
|
||||
|
||||
s.Config.Broadcast(cp)
|
||||
|
|
Loading…
Reference in a new issue