OSDN Git Service

update (#423)
[bytom/vapor.git] / database / wallet_store.go
index b810e46..ded9cfd 100644 (file)
@@ -5,6 +5,7 @@ import (
        "encoding/hex"
        "encoding/json"
        "fmt"
+       "strings"
 
        log "github.com/sirupsen/logrus"
 
@@ -190,7 +191,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 {
@@ -227,7 +228,7 @@ func (store *WalletStore) GetAsset(assetID *bc.AssetID) (*asset.Asset, error) {
                return nil, err
        }
 
-       alias := assetID.String()
+       alias := strings.ToUpper(assetID.String())
        externalAsset := &asset.Asset{
                AssetID:           *assetID,
                Alias:             &alias,
@@ -342,6 +343,7 @@ func (store *WalletStore) ListAccountUTXOs(id string, isSmartContract bool) ([]*
 
                confirmedUTXOs = append(confirmedUTXOs, utxo)
        }
+
        return confirmedUTXOs, nil
 }
 
@@ -376,8 +378,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