diff --git a/pkg/network/server.go b/pkg/network/server.go index 18f61fa33..998120553 100644 --- a/pkg/network/server.go +++ b/pkg/network/server.go @@ -108,6 +108,7 @@ type ( services map[string]Service extensHandlers map[string]func(*payload.Extensible) error txCallback func(*transaction.Transaction) + txCbHeight atomic.Uint32 txInLock sync.Mutex txInMap map[util.Uint256]struct{} @@ -1044,7 +1045,7 @@ func (s *Server) handleTxCmd(tx *transaction.Transaction) error { s.serviceLock.RLock() txCallback := s.txCallback s.serviceLock.RUnlock() - if txCallback != nil { + if txCallback != nil && s.chain.BlockHeight() <= s.txCbHeight.Load() { txCallback(tx) } if s.verifyAndPoolTX(tx) == nil { @@ -1344,6 +1345,8 @@ func (s *Server) RequestTx(hashes ...util.Uint256) { return } + s.txCbHeight.Store(s.chain.BlockHeight()) + for i := 0; i <= len(hashes)/payload.MaxHashesCount; i++ { start := i * payload.MaxHashesCount stop := (i + 1) * payload.MaxHashesCount