OSDN Git Service

update
authorChengcheng Zhang <943420582@qq.com>
Fri, 21 Jun 2019 01:46:28 +0000 (09:46 +0800)
committerChengcheng Zhang <943420582@qq.com>
Fri, 21 Jun 2019 01:46:28 +0000 (09:46 +0800)
wallet/store.go
wallet/wallet.go

index fbfd2a8..3f4fe25 100644 (file)
@@ -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
-}
index a0c8a02..028e0fa 100644 (file)
@@ -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