OSDN Git Service

fix query transactions error (#1703)
authoroysheng <33340252+oysheng@users.noreply.github.com>
Wed, 17 Apr 2019 08:30:22 +0000 (16:30 +0800)
committerPaladz <yzhu101@uottawa.ca>
Wed, 17 Apr 2019 08:30:22 +0000 (16:30 +0800)
* fix query transactions error

* optimise

api/query.go

index 5265475..330d431 100644 (file)
@@ -144,9 +144,10 @@ func (a *API) listTransactions(ctx context.Context, filter struct {
                transaction, err = a.wallet.GetTransactionByTxID(filter.ID)
                if err != nil && filter.Unconfirmed {
                        transaction, err = a.wallet.GetUnconfirmedTxByTxID(filter.ID)
-                       if err != nil {
-                               return NewErrorResponse(err)
-                       }
+               }
+
+               if err != nil {
+                       return NewErrorResponse(err)
                }
                transactions = []*query.AnnotatedTx{transaction}
        } else {