diff --git a/blockchain/asset/asset.go b/blockchain/asset/asset.go index 392d156d0..343711757 100644 --- a/blockchain/asset/asset.go +++ b/blockchain/asset/asset.go @@ -2,23 +2,18 @@ package asset import ( "context" - //"database/sql" "encoding/json" -// "fmt" "sync" "golang.org/x/crypto/sha3" "github.com/golang/groupcache/lru" "github.com/golang/groupcache/singleflight" -// "github.com/lib/pq" dbm "github.com/tendermint/tmlibs/db" -// "github.com/bytom/blockchain/pin" "github.com/bytom/blockchain/signers" "github.com/bytom/crypto/ed25519" "github.com/bytom/crypto/ed25519/chainkd" -// "chain/database/pg" "github.com/bytom/errors" "github.com/bytom/protocol" "github.com/bytom/protocol/bc" @@ -32,12 +27,11 @@ var ( ErrBadIdentifier = errors.New("either ID or alias must be specified, and not both") ) -func NewRegistry(db dbm.DB, chain *protocol.Chain/*, pinStore *pin.Store*/) *Registry { +func NewRegistry(db dbm.DB, chain *protocol.Chain) *Registry { return &Registry{ db: db, chain: chain, initialBlockHash: chain.InitialBlockHash, -// pinStore: pinStore, cache: lru.New(maxAssetCache), aliasCache: lru.New(maxAssetCache), } @@ -49,7 +43,6 @@ type Registry struct { chain *protocol.Chain indexer Saver initialBlockHash bc.Hash -// pinStore *pin.Store idGroup singleflight.Group aliasGroup singleflight.Group @@ -135,7 +128,7 @@ func (reg *Registry) Define(ctx context.Context, xpubs []chainkd.XPub, quorum in asset.Alias = &alias } - asset_id := []byte(assetSigner.ID) + asset_id := asset.AssetID.Bytes() ass, err := json.Marshal(asset) if err != nil { return nil, errors.Wrap(err, "failed marshal asset") diff --git a/blockchain/asset/builder.go b/blockchain/asset/builder.go index a1dc6f525..60a85f576 100644 --- a/blockchain/asset/builder.go +++ b/blockchain/asset/builder.go @@ -8,10 +8,8 @@ import ( "github.com/bytom/blockchain/signers" "github.com/bytom/blockchain/txbuilder" - //"chain/database/pg" chainjson "github.com/bytom/encoding/json" "github.com/bytom/log" -// "github.com/bytom/errors" "github.com/bytom/protocol/bc" "github.com/bytom/protocol/bc/legacy" ) @@ -41,12 +39,10 @@ func (a *issueAction) Build(ctx context.Context, builder *txbuilder.TemplateBuil return txbuilder.MissingFieldsError("asset_id") return nil } + log.Printf(ctx, "AssetId:%v\n", a.AssetId) asset, err := a.assets.findByID(ctx, *a.AssetId) -/* if errors.Root(err) == pg.ErrUserInputNotFound { - err = errors.WithDetailf(err, "missing asset with ID %x", a.AssetId.Bytes()) - } -*/ if err != nil { + if err != nil { return err } diff --git a/cmd/bytomcli/example/issue.go b/cmd/bytomcli/example/issue.go index e3ba16126..69be7f5e9 100644 --- a/cmd/bytomcli/example/issue.go +++ b/cmd/bytomcli/example/issue.go @@ -1,25 +1,11 @@ package example import ( - //"bytes" "context" -// "flag" "fmt" - //"io" - //"net" - //"net/http" - //"os" - //"path/filepath" - //"strings" - //"time" stdjson "encoding/json" - //"github.com/bytom/blockchain" "github.com/bytom/blockchain/rpc" - //"github.com/bytom/crypto/ed25519" - //"github.com/bytom/env" - //"github.com/bytom/errors" - //"github.com/bytom/log" "github.com/bytom/crypto/ed25519/chainkd" "github.com/bytom/blockchain/query" "github.com/bytom/blockchain/txbuilder"