mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-11-24 06:25:55 +00:00
Don't send notifications for header-only and invalid blocks
This commit is contained in:
parent
3f959be0a3
commit
8ff78ecdb0
@ -4,6 +4,8 @@ import (
|
||||
"math/big"
|
||||
"sync"
|
||||
|
||||
"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
|
||||
|
||||
"github.com/kaspanet/kaspad/util/mstime"
|
||||
|
||||
"github.com/kaspanet/kaspad/domain/consensus/database"
|
||||
@ -213,6 +215,14 @@ func (s *consensus) ValidateAndInsertBlock(block *externalapi.DomainBlock, shoul
|
||||
|
||||
func (s *consensus) sendBlockAddedEvent(block *externalapi.DomainBlock) error {
|
||||
if s.consensusEventsChan != nil {
|
||||
blockStatus, err := s.blockStatusStore.Get(s.databaseContext, model.NewStagingArea(), consensushashing.BlockHash(block))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if blockStatus == externalapi.StatusHeaderOnly || blockStatus == externalapi.StatusInvalid {
|
||||
return nil
|
||||
}
|
||||
|
||||
if len(s.consensusEventsChan) == cap(s.consensusEventsChan) {
|
||||
return errors.Errorf("consensusEventsChan is full")
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user