From: Paladz Date: Thu, 18 Apr 2019 07:37:02 +0000 (+0800) Subject: show all the tx in wallet (#1710) X-Git-Url: http://git.osdn.net/view?p=bytom%2Fbytom.git;a=commitdiff_plain;h=c4d5d5142740b4a986d2adfef21274f3a95a2369 show all the tx in wallet (#1710) --- diff --git a/wallet/indexer.go b/wallet/indexer.go index 0951a457..7bc68d22 100644 --- a/wallet/indexer.go +++ b/wallet/indexer.go @@ -11,7 +11,6 @@ import ( "github.com/bytom/account" "github.com/bytom/asset" "github.com/bytom/blockchain/query" - "github.com/bytom/crypto/sha3pool" dbm "github.com/bytom/database/leveldb" chainjson "github.com/bytom/encoding/json" "github.com/bytom/errors" @@ -155,29 +154,12 @@ func (w *Wallet) indexTransactions(batch dbm.Batch, b *types.Block, txStatus *bc func (w *Wallet) filterAccountTxs(b *types.Block, txStatus *bc.TransactionStatus) []*query.AnnotatedTx { annotatedTxs := make([]*query.AnnotatedTx, 0, len(b.Transactions)) -transactionLoop: for pos, tx := range b.Transactions { - statusFail, _ := txStatus.GetStatus(pos) - for _, v := range tx.Outputs { - var hash [32]byte - sha3pool.Sum256(hash[:], v.ControlProgram) - - if bytes := w.DB.Get(account.ContractKey(hash)); bytes != nil { - annotatedTxs = append(annotatedTxs, w.buildAnnotatedTransaction(tx, b, statusFail, pos)) - continue transactionLoop - } - } - - for _, v := range tx.Inputs { - outid, err := v.SpentOutputID() - if err != nil { - continue - } - if bytes := w.DB.Get(account.StandardUTXOKey(outid)); bytes != nil { - annotatedTxs = append(annotatedTxs, w.buildAnnotatedTransaction(tx, b, statusFail, pos)) - continue transactionLoop - } + if pos == 0 { + continue } + statusFail, _ := txStatus.GetStatus(pos) + annotatedTxs = append(annotatedTxs, w.buildAnnotatedTransaction(tx, b, statusFail, pos)) } return annotatedTxs