return program, nil
}
-// GetContractIndex return the current index
-func (m *Manager) GetContractIndex(accountID string) uint64 {
- index := uint64(0)
- if rawIndexBytes := m.store.GetContractIndex(accountID); rawIndexBytes != nil {
- index = common.BytesToUnit64(rawIndexBytes)
- }
- return index
-}
-
// GetBip44ContractIndex return the current bip44 contract index
func (m *Manager) GetBip44ContractIndex(accountID string, change bool) uint64 {
index := uint64(0)
}, nil
}
+func (m *Manager) GetContractIndex(accountID string) uint64 {
+ return m.store.GetContractIndex(accountID)
+}
+
func (m *Manager) getCurrentContractIndex(account *Account, change bool) (uint64, error) {
switch account.DeriveRule {
case signers.BIP0032:
- return m.GetContractIndex(account.ID), nil
+ return m.store.GetContractIndex(account.ID), nil
case signers.BIP0044:
return m.GetBip44ContractIndex(account.ID, change), nil
}
}
image.Slice = append(image.Slice, &ImageSlice{
Account: account,
- ContractIndex: m.GetContractIndex(account.ID),
+ ContractIndex: m.store.GetContractIndex(account.ID),
})
}
return image, nil
DeleteRawProgram(common.Hash)
DeleteBip44ContractIndex(string)
DeleteContractIndex(string)
- GetContractIndex(string) []byte
+ GetContractIndex(string) uint64
GetAccountUTXOs(string) [][]byte
DeleteStandardUTXO(bc.Hash)
GetCoinbaseArbitrary() []byte
}
// GetContractIndex get contract index
-func (store *AccountStore) GetContractIndex(accountID string) []byte {
- return store.accountDB.Get(contractIndexKey(accountID))
+func (store *AccountStore) GetContractIndex(accountID string) uint64 {
+ index := uint64(0)
+ if rawIndexBytes := store.accountDB.Get(contractIndexKey(accountID)); rawIndexBytes != nil {
+ index = common.BytesToUnit64(rawIndexBytes)
+ }
+ return index
}
// GetAccountUTXOs get account utxos by account id