• R/O
  • HTTP
  • SSH
  • HTTPS

vapor: Commit

Golang implemented sidechain for Bytom


Commit MetaInfo

Revision73f40d54126880235f710e714e26c859a8f492b1 (tree)
Time2019-07-11 17:26:30
AuthorChengcheng Zhang <943420582@qq.c...>
CommiterChengcheng Zhang

Log Message

update log

Change Summary

Incremental Difference

--- a/database/wallet_store.go
+++ b/database/wallet_store.go
@@ -246,7 +246,7 @@ func (store *WalletStore) GetGlobalTransactionIndex(txID string) []byte {
246246 func (store *WalletStore) GetStandardUTXO(outid bc.Hash) (*acc.UTXO, error) {
247247 rawUTXO := store.db.Get(StandardUTXOKey(outid))
248248 if rawUTXO == nil {
249- return nil, fmt.Errorf("failed get standard UTXO, outputID: %s ", outid.String())
249+ return nil, wallet.ErrGetStandardUTXO
250250 }
251251
252252 UTXO := new(acc.UTXO)
--- a/wallet/annotated.go
+++ b/wallet/annotated.go
@@ -32,7 +32,7 @@ func annotateTxsAsset(w *Wallet, txs []*query.AnnotatedTx) {
3232
3333 func (w *Wallet) getExternalDefinition(assetID *bc.AssetID) json.RawMessage {
3434 externalAsset, err := w.Store.GetAsset(assetID)
35- if err != nil {
35+ if err != nil && err != ErrGetAsset {
3636 log.WithFields(log.Fields{"module": logModule, "err": err, "assetID": assetID.String()}).Info("fail on get asset definition.")
3737 }
3838 if externalAsset == nil {
--- a/wallet/indexer.go
+++ b/wallet/indexer.go
@@ -106,22 +106,22 @@ transactionLoop:
106106 if _, err := w.AccountMgr.GetControlProgram(bc.NewHash(hash)); err == nil {
107107 annotatedTxs = append(annotatedTxs, w.buildAnnotatedTransaction(tx, b, statusFail, pos))
108108 continue transactionLoop
109- } else {
110- log.WithFields(log.Fields{"module": logModule, "err": err, "hash": hex.EncodeToString(hash[:])}).Info("filterAccountTxs fail.")
109+ } else if err != account.ErrFindCtrlProgram {
110+ log.WithFields(log.Fields{"module": logModule, "err": err, "hash": hex.EncodeToString(hash[:])}).Error("filterAccountTxs fail.")
111111 }
112112 }
113113
114114 for _, v := range tx.Inputs {
115115 outid, err := v.SpentOutputID()
116116 if err != nil {
117- log.WithFields(log.Fields{"module": logModule, "err": err, "outputID": hex.EncodeToString(outid.Bytes())}).Info("filterAccountTxs fail.")
117+ log.WithFields(log.Fields{"module": logModule, "err": err, "outputID": hex.EncodeToString(outid.Bytes())}).Error("filterAccountTxs fail.")
118118 continue
119119 }
120120 if _, err = w.Store.GetStandardUTXO(outid); err == nil {
121121 annotatedTxs = append(annotatedTxs, w.buildAnnotatedTransaction(tx, b, statusFail, pos))
122122 continue transactionLoop
123- } else {
124- log.WithFields(log.Fields{"module": logModule, "err": err, "outputID": hex.EncodeToString(outid.Bytes())}).Info("filterAccountTxs fail.")
123+ } else if err != ErrGetStandardUTXO {
124+ log.WithFields(log.Fields{"module": logModule, "err": err, "outputID": hex.EncodeToString(outid.Bytes())}).Error("filterAccountTxs fail.")
125125 }
126126 }
127127 }
--- a/wallet/unconfirmed.go
+++ b/wallet/unconfirmed.go
@@ -1,6 +1,7 @@
11 package wallet
22
33 import (
4+ "encoding/hex"
45 "fmt"
56 "sort"
67 "time"
@@ -9,6 +10,7 @@ import (
910
1011 log "github.com/sirupsen/logrus"
1112
13+ acc "github.com/vapor/account"
1214 "github.com/vapor/blockchain/query"
1315 "github.com/vapor/crypto/sha3pool"
1416 "github.com/vapor/protocol"
@@ -113,8 +115,8 @@ func (w *Wallet) checkRelatedTransaction(tx *types.Tx) bool {
113115 var hash [32]byte
114116 sha3pool.Sum256(hash[:], v.ControlProgram())
115117 cp, err := w.AccountMgr.GetControlProgram(bc.NewHash(hash))
116- if err != nil {
117- log.WithFields(log.Fields{"module": logModule, "err": err, "hash": string(hash[:])}).Error("checkRelatedTransaction fail.")
118+ if err != nil && err != acc.ErrFindCtrlProgram {
119+ log.WithFields(log.Fields{"module": logModule, "err": err, "hash": hex.EncodeToString(hash[:])}).Error("checkRelatedTransaction fail.")
118120 continue
119121 }
120122 if cp != nil {
@@ -128,7 +130,7 @@ func (w *Wallet) checkRelatedTransaction(tx *types.Tx) bool {
128130 continue
129131 }
130132 utxo, err := w.Store.GetStandardUTXO(outid)
131- if err != nil {
133+ if err != nil && err != ErrGetStandardUTXO {
132134 log.WithFields(log.Fields{"module": logModule, "err": err, "outputID": outid.String()}).Error("checkRelatedTransaction fail.")
133135 continue
134136 }
--- a/wallet/utxo.go
+++ b/wallet/utxo.go
@@ -121,7 +121,7 @@ func (w *Wallet) filterAccountUtxo(utxos []*account.UTXO) []*account.UTXO {
121121 var hash [32]byte
122122 sha3pool.Sum256(hash[:], []byte(s))
123123 cp, err := w.AccountMgr.GetControlProgram(bc.NewHash(hash))
124- if err != nil {
124+ if err != nil && err != account.ErrFindCtrlProgram {
125125 log.WithFields(log.Fields{"module": logModule, "err": err}).Error("filterAccountUtxo fail.")
126126 continue
127127 }
--- a/wallet/wallet.go
+++ b/wallet/wallet.go
@@ -29,6 +29,7 @@ var (
2929 ErrGetWalletStatusInfo = errors.New("failed get wallet info")
3030 ErrGetAsset = errors.New("Failed to find asset definition")
3131 ErrAccntTxIDNotFound = errors.New("account TXID not found")
32+ ErrGetStandardUTXO = errors.New("failed get standard UTXO")
3233 )
3334
3435 //StatusInfo is base valid block info to handle orphan block rollback
Show on old repository browser