forked from TrueCloudLab/neoneo-go
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.
|
// OnPayload handles Payload receive.
|
||||||
func (s *service) OnPayload(cp *Payload) {
|
func (s *service) OnPayload(cp *Payload) {
|
||||||
log := s.log.With(zap.Stringer("hash", cp.Hash()))
|
log := s.log.With(zap.Stringer("hash", cp.Hash()))
|
||||||
if !s.validatePayload(cp) {
|
if s.cache.Has(cp.Hash()) {
|
||||||
log.Debug("can't validate payload")
|
|
||||||
return
|
|
||||||
} else if s.cache.Has(cp.Hash()) {
|
|
||||||
log.Debug("payload is already in cache")
|
log.Debug("payload is already in cache")
|
||||||
return
|
return
|
||||||
|
} else if !s.validatePayload(cp) {
|
||||||
|
log.Debug("can't validate payload")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
s.Config.Broadcast(cp)
|
s.Config.Broadcast(cp)
|
||||||
|
|
Loading…
Reference in a new issue