From 7dc6fdd73247169229d32c866657418aa7568f52 Mon Sep 17 00:00:00 2001 From: Chengcheng Zhang <943420582@qq.com> Date: Fri, 21 Jun 2019 09:46:28 +0800 Subject: [PATCH] update --- wallet/store.go | 39 ++++++++++++++++++++------------------- wallet/wallet.go | 4 ++-- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/wallet/store.go b/wallet/store.go index fbfd2a82..3f4fe251 100644 --- a/wallet/store.go +++ b/wallet/store.go @@ -122,23 +122,24 @@ func (store *LevelDBStore) GetGlobalTxByTxID(txID string) []byte { return store.DB.Get(calcGlobalTxIndexKey(txID)) } -// GetTransactions get all walletDB transactions, and filter transactions by accountID optional -func (store *LevelDBStore) GetTransactionsByAccountID(accountID string) ([]*query.AnnotatedTx, error) { - annotatedTxs := []*query.AnnotatedTx{} +// // GetTransactions get all walletDB transactions, and filter transactions by accountID optional +// func (store *LevelDBStore) GetTransactionsByAccountID(accountID string) ([]*query.AnnotatedTx, error) { +// annotatedTxs := []*query.AnnotatedTx{} + +// txIter := store.DB.IteratorPrefix([]byte(TxPrefix)) +// defer txIter.Release() +// for txIter.Next() { +// annotatedTx := &query.AnnotatedTx{} +// if err := json.Unmarshal(txIter.Value(), &annotatedTx); err != nil { +// return nil, err +// } + +// if accountID == "" || findTransactionsByAccount(annotatedTx, accountID) { +// annotateTxsAsset(w, []*query.AnnotatedTx{annotatedTx}) +// annotatedTxs = append([]*query.AnnotatedTx{annotatedTx}, annotatedTxs...) +// } +// } + +// return annotatedTxs, nil +// } - txIter := store.DB.IteratorPrefix([]byte(TxPrefix)) - defer txIter.Release() - for txIter.Next() { - annotatedTx := &query.AnnotatedTx{} - if err := json.Unmarshal(txIter.Value(), &annotatedTx); err != nil { - return nil, err - } - - if accountID == "" || findTransactionsByAccount(annotatedTx, accountID) { - annotateTxsAsset(w, []*query.AnnotatedTx{annotatedTx}) - annotatedTxs = append([]*query.AnnotatedTx{annotatedTx}, annotatedTxs...) - } - } - - return annotatedTxs, nil -} diff --git a/wallet/wallet.go b/wallet/wallet.go index a0c8a025..028e0fac 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -42,8 +42,8 @@ type StatusInfo struct { //Wallet is related to storing account unspent outputs type Wallet struct { - // store Store - DB dbm.DB // delete it and replace + // DB DB + DB dbm.DB rw sync.RWMutex status StatusInfo TxIndexFlag bool -- 2.11.0