func (s *ShardMempool) Add(tx []byte) error {
	txHash := chainhash.HashH(tx)
	s.mempoolLock.Lock()
	defer s.mempoolLock.Unlock()

	logrus.WithField("hash", txHash).Info("adding new transaction to mempool")

	if _, found := s.mempool[txHash]; found {
		logrus.WithField("hash", txHash).Debug("transaction already exists")

		// don't do anything if it already exists
		return nil
	}

	if err := s.check(tx); err != nil {
		return err
	}

	poolItem := &shardMempoolItem{
		tx: tx,
	}

	s.mempool[txHash] = poolItem
	s.mempoolOrder = append(s.mempoolOrder, poolItem)

	return nil
}
// Add adds a transaction to the mempool.
Add adds a transaction to the mempool.
// Add adds a transaction to the mempool .
func (s *ShardMempool) Add(tx []byte) error {
	txHash := chainhash.HashH(tx)
	s.mempoolLock.Lock()
	defer s.mempoolLock.Unlock()
	logrus.WithField("hash", txHash).Info("adding new transaction to mempool")
	if _, found := s.mempool[txHash]; found {
		logrus.WithField("hash", txHash).Debug("transaction already exists")
		return nil
	}
	if err := s.check(tx); err != nil {
		return err
	}
	poolItem := &shardMempoolItem{
		tx: tx,
	}
	s.mempool[txHash] = poolItem
	s.mempoolOrder = append(s.mempoolOrder, poolItem)
	return nil
}
func ( s * ShardMempool ) Add ( tx [ ] byte ) error { txHash := chainhash . HashH ( tx ) s . mempoolLock . Lock ( ) defer s . mempoolLock . Unlock ( ) logrus . WithField ( " " , txHash ) . Info ( " " ) if _ , found := s . mempool [ txHash ] ; found { logrus . WithField ( " " , txHash ) . Debug ( " " ) return nil } if err := s . check ( tx ) ; err != nil { return err } poolItem := & shardMempoolItem { tx : tx , } s . mempool [ txHash ] = poolItem s . mempoolOrder = append ( s . mempoolOrder , poolItem ) return nil }
Add adds a transaction to the mempool.
Add adds a transaction to the mempool .
// don't do anything if it already exists