OSDN Git Service

fix log (#388)
[bytom/vapor.git] / database / wallet_store.go
index b810e46..c0bf9f9 100644 (file)
@@ -190,7 +190,7 @@ func (store *WalletStore) DeleteWalletTransactions() {
        }
 }
 
-// DeleteWalletUTXOs delete all txs in wallet
+// DeleteWalletUTXOs delete all utxos in wallet
 func (store *WalletStore) DeleteWalletUTXOs() {
        batch := store.db.NewBatch()
        if store.batch != nil {
@@ -342,6 +342,7 @@ func (store *WalletStore) ListAccountUTXOs(id string, isSmartContract bool) ([]*
 
                confirmedUTXOs = append(confirmedUTXOs, utxo)
        }
+
        return confirmedUTXOs, nil
 }
 
@@ -376,8 +377,10 @@ func (store *WalletStore) ListTransactions(accountID string, StartTxID string, c
                        return nil, err
                }
 
-               annotatedTxs = append(annotatedTxs, annotatedTx)
-               txNum--
+               if accountID == "" || wallet.FindTransactionsByAccount(annotatedTx, accountID) {
+                       annotatedTxs = append([]*query.AnnotatedTx{annotatedTx}, annotatedTxs...)
+                       txNum--
+               }
        }
 
        return annotatedTxs, nil