OSDN Git Service

rename GetGlobalTransactionIndex
authorChengcheng Zhang <943420582@qq.com>
Fri, 28 Jun 2019 07:41:39 +0000 (15:41 +0800)
committerChengcheng Zhang <943420582@qq.com>
Fri, 28 Jun 2019 07:41:39 +0000 (15:41 +0800)
database/wallet_store.go
wallet/indexer.go
wallet/store.go
wallet/wallet_test.go

index 57e07dc..3d3c3bb 100644 (file)
@@ -332,8 +332,8 @@ func (store *WalletStore) GetTransaction(txID string) (*query.AnnotatedTx, error
        return tx, nil
 }
 
-// GetGlobalTransaction get global tx by txID
-func (store *WalletStore) GetGlobalTransaction(txID string) []byte {
+// GetGlobalTransactionIndex get global tx by txID
+func (store *WalletStore) GetGlobalTransactionIndex(txID string) []byte {
        return store.walletDB.Get(calcGlobalTxIndexKey(txID))
 }
 
index 6274179..4982e64 100644 (file)
@@ -153,7 +153,7 @@ func (w *Wallet) getAccountTxByTxID(txID string) (*query.AnnotatedTx, error) {
 }
 
 func (w *Wallet) getGlobalTxByTxID(txID string) (*query.AnnotatedTx, error) {
-       globalTxIdx := w.store.GetGlobalTransaction(txID)
+       globalTxIdx := w.store.GetGlobalTransactionIndex(txID)
        if globalTxIdx == nil {
                return nil, fmt.Errorf("No transaction(tx_id=%s) ", txID)
        }
index 0b6f913..e654e73 100644 (file)
@@ -22,7 +22,7 @@ type WalletStorer interface {
        SetGlobalTransactionIndex(string, *bc.Hash, uint64)
        GetStandardUTXO(bc.Hash) (*acc.UTXO, error)
        GetTransaction(string) (*query.AnnotatedTx, error)
-       GetGlobalTransaction(string) []byte
+       GetGlobalTransactionIndex(string) []byte
        GetTransactions() ([]*query.AnnotatedTx, error)
        GetUnconfirmedTransactions() ([]*query.AnnotatedTx, error)
        GetUnconfirmedTransaction(string) []byte
index c199d9e..599a4fc 100644 (file)
@@ -199,7 +199,7 @@ func TestWalletUpdate(t *testing.T) {
        }
 
        for position, tx := range block.Transactions {
-               get := w.store.GetGlobalTransaction(tx.ID.String())
+               get := w.store.GetGlobalTransactionIndex(tx.ID.String())
                bh := block.BlockHeader.Hash()
                expect := database.CalcGlobalTxIndex(&bh, uint64(position))
                if !reflect.DeepEqual(get, expect) {