// Create creates a new Account.
func (m *Manager) Create(ctx context.Context, xpubs []chainkd.XPub, quorum int, alias string, tags map[string]interface{}, clientToken string) (*Account, error) {
- if ret := m.db.Get(json.RawMessage("ali" + alias)); len(ret) != 0 {
+ if ret := m.db.Get(json.RawMessage("ali" + alias)); ret != nil {
return nil, errors.New(fmt.Sprintf("alias:%s already exists", alias))
}
}
bytes := m.db.Get(key_id)
- if len(bytes) == 0 {
+ if bytes == nil {
return errors.New("no exit this account")
}
}
bytes := m.db.Get(json.RawMessage(id))
- if len(bytes) == 0 {
+ if bytes == nil {
return nil, errors.New("not find this account.")
}
for s := range outsByScript {
sha3pool.Sum256(b32[:], []byte(s))
bytes := m.db.Get(json.RawMessage("acp" + string(b32[:])))
- if len(bytes) == 0 {
+ if bytes == nil {
continue
}
//filte the accounts which exists in accountdb with wallet enabled
isExist := m.db.Get(json.RawMessage(cp.AccountID))
- if len(isExist) == 0 {
+ if isExist == nil {
continue
}
b32 := new([4][32]byte)
accUTXOValue := db.Get(json.RawMessage("acu" + string(outHash.Bytes())))
- if len(accUTXOValue) != 0 {
+ if accUTXOValue != nil {
err := json.Unmarshal(accUTXOValue, &au)
if err != nil {
return nil, errors.Wrap(err)
}
bytes := reg.db.Get([]byte(id.String()))
- if len(bytes) == 0 {
+ if bytes == nil {
return nil, errors.New("no exit this asset.")
}
var asset Asset
)
bytes := p.db.Get(json.RawMessage("blp" + p.name))
- if len(bytes) != 0 {
+ if bytes != nil {
err = json.Unmarshal(bytes, &block_processor)
if err == nil && block_processor.Height >= max {
goto Noupdate
func LoadSnapshotHeightJSON(db dbm.DB) SnapshotHeightJSON {
bytes := db.Get(latestSnapshotHeight)
- if len(bytes) == 0 {
+ if bytes == nil {
return SnapshotHeightJSON{
Height: 0,
}
func getStateSnapshot(ctx context.Context, db dbm.DB) (*state.Snapshot, uint64, error) {
height := LoadSnapshotHeightJSON(db).Height
data := db.Get(calcSnapshotKey(height))
- if len(data) == 0 {
+ if data == nil {
return nil, height, errors.New("no this snapshot.")
}
// provided height.
func getRawSnapshot(ctx context.Context, db dbm.DB, height uint64) (data []byte, err error) {
bytez := db.Get(calcSnapshotKey(height))
- if len(bytez) == 0 {
+ if bytez == nil {
return nil, errors.New("no this height snapshot.")
}
return bytez, nil
func LoadBlock(db dbm.DB, height uint64) *legacy.Block {
var block *legacy.Block = &legacy.Block{}
bytez := db.Get(calcBlockKey(height))
- if len(bytez) == 0 {
+ if bytez == nil {
return nil
}
func LoadBlockStoreStateJSON(db dbm.DB) BlockStoreStateJSON {
bytes := db.Get(blockStoreKey)
- if len(bytes) == 0 {
+ if bytes == nil {
return BlockStoreStateJSON{
Height: 0,
}
func (s *Store) GetRawBlock(height uint64) ([]byte, error) {
bytez := s.db.Get(calcBlockKey(height))
- if len(bytez) == 0 {
+ if bytez == nil {
return nil, errors.New("querying blocks from the db null")
}
return bytez, nil