OSDN Git Service

add issue program error (#1281)
authoroysheng <33340252+oysheng@users.noreply.github.com>
Mon, 27 Aug 2018 07:22:35 +0000 (15:22 +0800)
committerPaladz <yzhu101@uottawa.ca>
Mon, 27 Aug 2018 07:22:35 +0000 (15:22 +0800)
* add issue program error

* optimise

asset/builder.go
cmd/bytomcli/commands/asset.go

index 433e4c3..25fef0c 100644 (file)
@@ -53,10 +53,10 @@ func (a *issueAction) Build(ctx context.Context, builder *txbuilder.TemplateBuil
 
        txin := types.NewIssuanceInput(nonce[:], a.Amount, asset.IssuanceProgram, nil, asset.RawDefinitionByte)
        tplIn := &txbuilder.SigningInstruction{}
-       if a.Arguments == nil {
+       if asset.Signer != nil {
                path := signers.Path(asset.Signer, signers.AssetKeySpace)
                tplIn.AddRawWitnessKeys(asset.Signer.XPubs, path, asset.Signer.Quorum)
-       } else {
+       } else if a.Arguments != nil {
                if err := txbuilder.AddContractArgs(tplIn, a.Arguments); err != nil {
                        return err
                }
index 6c2dfb7..16cc2c3 100644 (file)
@@ -32,7 +32,7 @@ var (
 var createAssetCmd = &cobra.Command{
        Use:   "create-asset <alias> <xpub(s)>",
        Short: "Create an asset",
-       Args:  cobra.RangeArgs(1, 2),
+       Args:  cobra.RangeArgs(1, 5),
        Run: func(cmd *cobra.Command, args []string) {
 
                var ins assetIns