OSDN Git Service

rename GetRawProgram
authorChengcheng Zhang <943420582@qq.com>
Sat, 22 Jun 2019 08:21:25 +0000 (16:21 +0800)
committerChengcheng Zhang <943420582@qq.com>
Sat, 22 Jun 2019 08:21:25 +0000 (16:21 +0800)
wallet/annotated.go
wallet/indexer.go
wallet/store.go
wallet/unconfirmed.go
wallet/utxo.go

index fab2a9e..9b5e9fc 100644 (file)
@@ -112,7 +112,7 @@ func getAccountFromACP(program []byte, store Store) (*account.Account, error) {
        localAccount := account.Account{}
 
        sha3pool.Sum256(hash[:], program)
-       rawProgram := store.GetRawProgramByHash(hash)
+       rawProgram := store.GetRawProgram(hash)
        if rawProgram == nil {
                return nil, fmt.Errorf("failed get account control program:%x ", hash)
        }
index d3db27a..32ca27f 100644 (file)
@@ -140,7 +140,7 @@ transactionLoop:
                        var hash [32]byte
                        sha3pool.Sum256(hash[:], v.ControlProgram())
 
-                       if bytes := w.store.GetRawProgramByHash(hash); bytes != nil {
+                       if bytes := w.store.GetRawProgram(hash); bytes != nil {
                                annotatedTxs = append(annotatedTxs, w.buildAnnotatedTransaction(tx, b, statusFail, pos))
                                continue transactionLoop
                        }
index 50b3f3b..7455437 100644 (file)
@@ -16,7 +16,7 @@ import (
 type Store interface {
        GetAssetDefinition(*bc.AssetID) []byte
        SetAssetDefinition(*bc.AssetID, []byte)
-       GetRawProgramByHash(common.Hash) []byte
+       GetRawProgram(common.Hash) []byte
        GetAccount(string) []byte
        DeleteTransaction(uint64)
        SetTransaction(uint64, uint32, string, []byte)
@@ -65,8 +65,8 @@ func (store *LevelDBStore) SetAssetDefinition(assetID *bc.AssetID, definition []
        store.DB.Set(asset.ExtAssetKey(assetID), definition)
 }
 
-// GetRawProgramByHash get raw program by hash
-func (store *LevelDBStore) GetRawProgramByHash(hash common.Hash) []byte {
+// GetRawProgram get raw program by hash
+func (store *LevelDBStore) GetRawProgram(hash common.Hash) []byte {
        return store.DB.Get(account.ContractKey(hash))
 }
 
index 04bbae9..6ad590f 100644 (file)
@@ -111,7 +111,7 @@ func (w *Wallet) checkRelatedTransaction(tx *types.Tx) bool {
        for _, v := range tx.Outputs {
                var hash [32]byte
                sha3pool.Sum256(hash[:], v.ControlProgram())
-               if bytes := w.store.GetRawProgramByHash(hash); bytes != nil {
+               if bytes := w.store.GetRawProgram(hash); bytes != nil {
                        return true
                }
        }
index c10963e..532ded7 100644 (file)
@@ -122,7 +122,7 @@ func (w *Wallet) filterAccountUtxo(utxos []*account.UTXO) []*account.UTXO {
 
                var hash [32]byte
                sha3pool.Sum256(hash[:], []byte(s))
-               data := w.store.GetRawProgramByHash(hash)
+               data := w.store.GetRawProgram(hash)
                if data == nil {
                        continue
                }