core: use errors.Is in PoolTx

Just in case.
This commit is contained in:
Roman Khimov 2020-08-06 20:13:25 +03:00
parent 4c38fae54c
commit c19838ea67

View file

@ -1378,10 +1378,10 @@ func (bc *Blockchain) PoolTx(t *transaction.Transaction) error {
return fmt.Errorf("%w: %v", ErrPolicy, err) return fmt.Errorf("%w: %v", ErrPolicy, err)
} }
if err := bc.memPool.Add(t, bc); err != nil { if err := bc.memPool.Add(t, bc); err != nil {
switch err { switch {
case mempool.ErrOOM: case errors.Is(err, mempool.ErrOOM):
return ErrOOM return ErrOOM
case mempool.ErrDup: case errors.Is(err, mempool.ErrDup):
return fmt.Errorf("mempool: %w", ErrAlreadyExists) return fmt.Errorf("mempool: %w", ErrAlreadyExists)
default: default:
return err return err