OSDN Git Service

rename GetAccountByAccountID
authorChengcheng Zhang <943420582@qq.com>
Sat, 29 Jun 2019 05:02:24 +0000 (13:02 +0800)
committerChengcheng Zhang <943420582@qq.com>
Sat, 29 Jun 2019 05:02:24 +0000 (13:02 +0800)
account/accounts.go
account/image.go
account/store.go
database/account_store.go
database/wallet_store.go
wallet/annotated.go
wallet/store.go

index 207fed3..868f5c4 100644 (file)
@@ -200,7 +200,7 @@ func (m *Manager) UpdateAccountAlias(accountID string, newAlias string) error {
 
        m.store.InitBatch()
 
-       m.store.DeleteAccountByAccountAlias(oldAlias)
+       m.store.DeleteAccountByAlias(oldAlias)
        if err := m.store.SetAccount(account); err != nil {
                return err
        }
@@ -305,8 +305,8 @@ func (m *Manager) DeleteAccount(accountID string) (err error) {
        m.cacheMu.Unlock()
 
        m.store.InitBatch()
-       m.store.DeleteAccountByAccountAlias(account.Alias)
-       m.store.DeleteAccountByAccountID(account.ID)
+       m.store.DeleteAccountByAlias(account.Alias)
+       m.store.DeleteAccountByID(account.ID)
        m.store.CommitBatch()
 
        return nil
@@ -341,7 +341,7 @@ func (m *Manager) FindByID(id string) (*Account, error) {
                return cachedAccount.(*Account), nil
        }
 
-       account, err := m.store.GetAccountByAccountID(id)
+       account, err := m.store.GetAccountByID(id)
        if err != nil {
                return nil, err
        }
@@ -354,7 +354,7 @@ func (m *Manager) FindByID(id string) (*Account, error) {
 
 // GetAccountByProgram return Account by given CtrlProgram
 func (m *Manager) GetAccountByProgram(program *CtrlProgram) (*Account, error) {
-       account, err := m.store.GetAccountByAccountID(program.AccountID)
+       account, err := m.store.GetAccountByID(program.AccountID)
        if err != nil {
                return nil, err
        }
@@ -379,7 +379,7 @@ func (m *Manager) GetAccountByXPubsIndex(xPubs []chainkd.XPub, index uint64) (*A
 
 // GetAliasByID return the account alias by given ID
 func (m *Manager) GetAliasByID(id string) string {
-       account, err := m.store.GetAccountByAccountID(id)
+       account, err := m.store.GetAccountByID(id)
        if err != nil {
                log.Warn("GetAliasByID fail to find account")
                return ""
index b0f5c86..62ce449 100644 (file)
@@ -47,7 +47,7 @@ func (m *Manager) Restore(image *Image) error {
        m.store.InitBatch()
 
        for _, slice := range image.Slice {
-               existed, err := m.store.GetAccountByAccountID(slice.Account.ID)
+               existed, err := m.store.GetAccountByID(slice.Account.ID)
                if err != nil || existed != nil {
                        log.WithFields(log.Fields{
                                "module": logModule,
index 659c56d..bc6d705 100644 (file)
@@ -13,10 +13,10 @@ type AccountStorer interface {
        SetAccount(*Account) error
        SetAccountIndex(*Account) error
        GetAccountIDByAlias(string) string
-       GetAccountByAccountID(string) (*Account, error)
+       GetAccountByID(string) (*Account, error)
        GetAccountIndex([]chainkd.XPub) uint64
-       DeleteAccountByAccountAlias(string)
-       DeleteAccountByAccountID(string)
+       DeleteAccountByAlias(string)
+       DeleteAccountByID(string)
        DeleteControlProgram(common.Hash)
        DeleteBip44ContractIndex(string)
        DeleteContractIndex(string)
index 7387a4f..307d7c1 100644 (file)
@@ -103,8 +103,8 @@ func (store *AccountStore) GetAccountIDByAlias(accountAlias string) string {
        return string(accountID)
 }
 
-// GetAccountByAccountID get account by accountID
-func (store *AccountStore) GetAccountByAccountID(accountID string) (*acc.Account, error) {
+// GetAccountByID get account by accountID
+func (store *AccountStore) GetAccountByID(accountID string) (*acc.Account, error) {
        account := new(acc.Account)
        rawAccount := store.accountDB.Get(AccountIDKey(accountID))
        if rawAccount == nil {
@@ -125,8 +125,8 @@ func (store *AccountStore) GetAccountIndex(xpubs []chainkd.XPub) uint64 {
        return currentIndex
 }
 
-// DeleteAccountByAccountAlias delete account by account alias
-func (store *AccountStore) DeleteAccountByAccountAlias(accountAlias string) {
+// DeleteAccountByAlias delete account by account alias
+func (store *AccountStore) DeleteAccountByAlias(accountAlias string) {
        if store.batch == nil {
                store.accountDB.Delete(accountAliasKey(accountAlias))
        } else {
@@ -134,8 +134,8 @@ func (store *AccountStore) DeleteAccountByAccountAlias(accountAlias string) {
        }
 }
 
-// DeleteAccountByAccountID delete account by accountID
-func (store *AccountStore) DeleteAccountByAccountID(accountID string) {
+// DeleteAccountByID delete account by accountID
+func (store *AccountStore) DeleteAccountByID(accountID string) {
        if store.batch == nil {
                store.accountDB.Delete(AccountIDKey(accountID))
        } else {
index 11c0710..4b6ac0c 100644 (file)
@@ -235,8 +235,8 @@ func (store *WalletStore) GetControlProgram(hash common.Hash) (*acc.CtrlProgram,
        return accountCP, nil
 }
 
-// GetAccountByAccountID get account value by account ID
-func (store *WalletStore) GetAccountByAccountID(accountID string) (*acc.Account, error) {
+// GetAccountByID get account value by account ID
+func (store *WalletStore) GetAccountByID(accountID string) (*acc.Account, error) {
        rawAccount := store.walletDB.Get(AccountIDKey(accountID))
        if rawAccount == nil {
                return nil, fmt.Errorf("failed get account, accountID: %s ", accountID)
index c5d8717..15bae7b 100644 (file)
@@ -108,7 +108,7 @@ func getAccountFromACP(program []byte, store WalletStorer) (*account.Account, er
                return nil, fmt.Errorf("failed get account control program:%x ", hash)
        }
 
-       account, err := store.GetAccountByAccountID(accountCP.AccountID)
+       account, err := store.GetAccountByID(accountCP.AccountID)
        if err != nil {
                return nil, err
        }
index 1074828..3d7cce3 100644 (file)
@@ -15,7 +15,7 @@ type WalletStorer interface {
        GetAssetDefinition(*bc.AssetID) (*asset.Asset, error)
        SetAssetDefinition(*bc.AssetID, []byte)
        GetControlProgram(common.Hash) (*acc.CtrlProgram, error)
-       GetAccountByAccountID(string) (*acc.Account, error)
+       GetAccountByID(string) (*acc.Account, error)
        DeleteTransactions(uint64)
        SetTransaction(uint64, *query.AnnotatedTx) error
        DeleteUnconfirmedTransaction(string)