OSDN Git Service

Merge branch 'dev' into wallet_optimise
authoroysheng <oysheng@bytom.io>
Mon, 16 Apr 2018 01:47:14 +0000 (09:47 +0800)
committeroysheng <oysheng@bytom.io>
Mon, 16 Apr 2018 01:47:14 +0000 (09:47 +0800)
1  2 
asset/asset.go
asset/asset_test.go
wallet/wallet_test.go

diff --cc asset/asset.go
@@@ -204,34 -200,7 +202,7 @@@ func (reg *Registry) Define(xpubs []cha
        return asset, nil
  }
  
- // UpdateTags modifies the tags of the specified asset. The asset may be
- // identified either by id or alias, but not both.
- func (reg *Registry) UpdateTags(ctx context.Context, assetInfo string, tags map[string]interface{}) (err error) {
-       asset := &Asset{}
-       if asset, err = reg.FindByAlias(ctx, assetInfo); err != nil {
-               assetID := &bc.AssetID{}
-               if err := assetID.UnmarshalText([]byte(assetInfo)); err != nil {
-                       return err
-               }
-               if asset, err = reg.FindByID(ctx, assetID); err != nil {
-                       return err
-               }
-       }
-       asset.Tags = tags
-       rawAsset, err := json.Marshal(asset)
-       if err != nil {
-               return ErrMarshalAsset
-       }
-       reg.db.Set(Key(&asset.AssetID), rawAsset)
-       reg.cacheMu.Lock()
-       reg.cache.Add(asset.AssetID, asset)
-       reg.cacheMu.Unlock()
-       return nil
- }
 -// findByID retrieves an Asset record along with its signer, given an assetID.
 +// FindByID retrieves an Asset record along with its signer, given an assetID.
  func (reg *Registry) FindByID(ctx context.Context, id *bc.AssetID) (*Asset, error) {
        reg.cacheMu.Lock()
        cached, ok := reg.cache.Get(id.String())
Simple merge
@@@ -64,8 -64,8 +64,8 @@@ func TestWalletUpdate(t *testing.T) 
  
        controlProg.KeyIndex = 1
  
 -      utxo := mockUTXO(controlProg)
 -      _, txData, err := mockTxData(utxo, testAccount)
 +      reg := asset.NewRegistry(testDB, chain)
-       asset, err := reg.Define([]chainkd.XPub{xpub1.XPub}, 1, nil, "TESTASSET", nil)
++      asset, err := reg.Define([]chainkd.XPub{xpub1.XPub}, 1, nil, "TESTASSET")
        if err != nil {
                t.Fatal(err)
        }